Datasets:
Tasks:
Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Add files using upload-large-folder tool
Browse filesFiles changed (50)
- md/dev/MSBDFwGYwwt/MSBDFwGYwwt.mdAdded+297
- md/dev/ZlCpRiZN7n/ZlCpRiZN7n.mdAdded+315
- md/dev/nrksGSRT7kX/nrksGSRT7kX.mdAdded+362
- md/train/0lz69oI5iZP/0lz69oI5iZP.mdAdded+241
- md/train/B1IzH7cxl/B1IzH7cxl.mdAdded+401
- md/train/BJE-4xW0W/BJE-4xW0W.mdAdded
- md/train/BJbD_Pqlg/BJbD_Pqlg.mdAdded+398
- md/train/BJgcwh4FwS/BJgcwh4FwS.mdAdded+467
- md/train/BJl_VnR9Km/BJl_VnR9Km.mdAdded+320
- md/train/ByG8A7cee/ByG8A7cee.mdAdded+331
- md/train/CoJibBRjPXQ/CoJibBRjPXQ.mdAdded+509
- md/train/FsLTUzZlsgT/FsLTUzZlsgT.mdAdded+360
- md/train/H1e_cC4twS/H1e_cC4twS.mdAdded+358
- md/train/H1eqOnNYDH/H1eqOnNYDH.mdAdded+396
- md/train/H1xk8jAqKQ/H1xk8jAqKQ.mdAdded+398
- md/train/HJBhEMbRb/HJBhEMbRb.mdAdded+557
- md/train/HJWHIKqgl/HJWHIKqgl.mdAdded
- md/train/HJem3yHKwH/HJem3yHKwH.mdAdded
- md/train/HJx8HANFDH/HJx8HANFDH.mdAdded
- md/train/Hkg5lAEtvS/Hkg5lAEtvS.mdAdded
- md/train/HkpYwMZRb/HkpYwMZRb.mdAdded
- md/train/OU98jZWS3x_/OU98jZWS3x_.mdAdded
- md/train/S1c2cvqee/S1c2cvqee.mdAdded
- md/train/S1lvm305YQ/S1lvm305YQ.mdAdded
- md/train/S1vuO-bCW/S1vuO-bCW.mdAdded
- md/train/SJeeL04KvH/SJeeL04KvH.mdAdded
- md/train/SJlhPMWAW/SJlhPMWAW.mdAdded
- md/train/SJxstlHFPH/SJxstlHFPH.mdAdded
- md/train/Sk-oDY9ge/Sk-oDY9ge.mdAdded
- md/train/SkEqro0ctQ/SkEqro0ctQ.mdAdded
- md/train/SkVhlh09tX/SkVhlh09tX.mdAdded
- md/train/Skgb5h4KPH/Skgb5h4KPH.mdAdded
- md/train/Skn9Shcxe/Skn9Shcxe.mdAdded
- md/train/SyxnvsAqFm/SyxnvsAqFm.mdAdded
- md/train/TR-Nj6nFx42/TR-Nj6nFx42.mdAdded
- md/train/YUEFlzlG_0c/YUEFlzlG_0c.mdAdded
- md/train/fIn4wLS2XzU/fIn4wLS2XzU.mdAdded
- md/train/hm0i-cunzGW/hm0i-cunzGW.mdAdded
- md/train/i_Q1yrOegLY/i_Q1yrOegLY.mdAdded
- md/train/iklDP-v1sgi/iklDP-v1sgi.mdAdded
- md/train/lM2971LAwV/lM2971LAwV.mdAdded
- md/train/q8qLAbQBupm/q8qLAbQBupm.mdAdded
- md/train/r1lZgyBYwS/r1lZgyBYwS.mdAdded
- md/train/rJe4_xSFDB/rJe4_xSFDB.mdAdded
- md/train/rJqFGTslg/rJqFGTslg.mdAdded
- md/train/rJxt0JHKvS/rJxt0JHKvS.mdAdded
- md/train/rkEFLFqee/rkEFLFqee.mdAdded
- md/train/ryloogSKDS/ryloogSKDS.mdAdded
- md/train/yvQKLaqNE6M/yvQKLaqNE6M.mdAdded
- md/train/zv-typ1gPxA/zv-typ1gPxA.mdAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297# TANKBind: Trigonometry-Aware Neural NetworKs for Drug-Protein Binding Structure Prediction
Wei Lu∗† Galixir Technologies
Qifeng Wu† Fudan University
Jixian Zhang† Galixir Technologies
Jiahua Rao Sun Yat-sen University
Chengtao Li Galixir Technologies
Shuangjia Zheng∗† Galixir Technologies Sun Yat-sen University
# Abstract
Illuminating interactions between proteins and small drug molecules is a longstanding challenge in the field of drug discovery. Despite the importance of understanding these interactions, most previous works are limited by hand-designed scoring functions and insufficient conformation sampling. The recently-proposed graph neural network-based methods provides alternatives to predict protein-ligand complex conformation in a one-shot manner. However, these methods neglect the geometric constraints of the complex structure and weaken the role of local functional regions. As a result, they might produce unreasonable conformations for challenging targets and generalize poorly to novel proteins. In this paper, we propose Trigonometry-Aware Neural networKs for binding structure prediction, TANKBind, that builds trigonometry constraint as a vigorous inductive bias into the model and explicitly attends to all possible binding sites for each protein by segmenting the whole protein into functional blocks. We construct novel contrastive losses with local region negative sampling to jointly optimize the binding interaction and affinity. Extensive experiments show substantial performance gains in comparison to state-of-the-art physics-based and deep learning-based methods on commonly-used benchmark datasets for both binding structure and affinity predictions with variant settings.
# 1 Introduction
Proteins are the workhorses of human bodies. They have a wide range of interaction partners, small molecules, other proteins, and DNA/RNA, for example. In this paper, we focus on drug-like small molecules as the interaction partners for proteins. The words ligands, drugs, small molecules and compounds are used interchangeably throughout the paper. Small molecules activate or inhibit activities of target proteins through mostly non-covalent interactions. In 2021, FDA approved 60 new drugs, among which 36 were small molecules Kinch et al. [2022]. Understanding the mechanismof-actions and off-target effects of drug molecules typically requires analyzing the structures of the related protein-ligand complexes Boopathi et al. [2021], Xie et al. [2011], but solving the complex structure experimentally is a an extremely challenging task. Despite tremendous effort spent on this topic over the last 50 years, only about 19,000 protein-ligand complex structures have been solved experimentally using $\mathbf { X }$ -ray, Cryo-EM or NMR Liu et al. [2015]. On the other hand, the estimated chemical space of drug is $\mathrm { 1 0 ^ { 6 \bar { 0 } } }$ and estimated number of unique proteins in human body is at least 20, 000, making the number of possible protein-ligand complex far exceeding the number of experimentally solved structures Reymond et al. [2010], Ponomarenko et al. [2016].
On the computational side, molecular docking is a commonly-used method for predicting the proteinligand complex structures the corresponding binding affinities Trott and Olson [2010], Friesner et al. [2004], Ackloo et al. [2022], Gentile et al. [2022]. Generally, the docking process involves three main stages: (1) locating favorable binding sites given a protein target; (2) sampling the ligand conformation as well as its position and orientation within these sites; (3) scoring and ranking the conformations of the complex using physics-inspired empirical energy functions to refine the structures and assess protein-ligand binding affinity. Due to its good interpretability and usability, docking has been integrated in drug development process for a long time and a number of successful cases have been reported Anderson [2003]. However, most open-source docking packages use atomlevel pairwise scoring functions, limiting the capacity to model the many-body effects. Moreover, they need to sample a large range of possible ligand poses and protein side-chain conformations, which leads to relatively high computational cost Trott and Olson [2010], Jain [2006].
To overcome these challenges, we propose a two-stage deep learning framework to neuralize the molecular docking process and predict the binding structures with better accuracy and lower computational cost. In the first stage, we segment the whole protein into functional blocks and predict their interactions with the ligand, creating an protein-ligand interaction energy landscape using a novel trigonometry-aware architecture. The trigonometry module has enough model capacity to capture many-body effects. In the second stage, we prioritize the crystallized binding structures by constrastively ensuring a weaker binding affinity for non-native interactions. In particular, our model improves the drug-protein binding structure predictions with a combination of (i) a novel trigonometry-aware architecture that jointly infuses trigonometry constraints and excluded-volume effects as inductive biases, (ii) a new divide-and-conquer strategy that constructs the protein-ligand local functional binding pairs in a contrastive manner. By doing so, we create a funnel-shape energy landscape for the inter-molecular interaction, removing the need of extensive sampling Jumper et al. [2021], Jain [2006], Chen et al. [2020a], Onuchic et al. [1997].
Our novel method is well-motivated by leveraging prior knowledge from physics and biology. Physically, the inter-molecular trigonometry module, inspired by the intra-molecular Evoformer module used in AlphaFold2 Jumper et al. [2021], ensures that our energy landscape disfavors configurations of protein-ligand complexes that are prohibited by laws of nature, for instance, no two atoms could overlap and the distances between atoms have to satisfy triangle inequality theorem in euclidean geometry. More details on these constraints is shown in section 3.3. Biologically, the functional regions of proteins tend to be more conserved and closely associated with binding De Juan et al. [2013], Glaser et al. [2003], allowing the model to learn critical information and generalize better to unseen proteins.
We evaluate our algorithm against several state-of-the-art deep learning and physics-based docking methods on task of binding structure prediction under multiple settings. Compared with baselines, our model increase the fraction of predictions with ligand root-mean-square deviation (RMSD) less than $5 \mathring \mathrm { A }$ by $16 \%$ in re-docking setting, $22 \%$ in self-docking setting, and $42 \%$ in the more difficult newprotein setting. Our model is also capable of predicting binding affinities, achieving better correlations with experimentally-measured values than sequence-based, structure-based and even complex-based methods. We also show that TankBind has the potential to discover novel mechanism-of-actions of drug molecules by identifying unseen protein binding sites.
# 2 Related Work
Geometric Deep Learning for drug discovery. There has been a surge of interest in integrating geometric priors for representation learning in the domain of drug discovery Jumper et al. [2021], Baek et al. [2021], Jing et al. [2021], Ganea et al. [2021], Jin et al. [2021], Ingraham et al. [2019], AlQuraishi [2019], Schütt et al. [2017], Somnath et al. [2021]. Recent researches have incorporated geometric information and symmetry properties of the input signals to improve the spatial perception of the learned representations. These works have been shown great potential in various applications like protein structure modeling Jumper et al. [2021], Baek et al. [2021], Jing et al. [2021], Ganea et al. [2021], molecular low-energy generation prediction Shi et al. [2021], Xu et al. [2022], Méndez-Lucio et al. [2021], property/function prediction Schütt et al. [2017], Somnath et al. [2021] and molecule design Jin et al. [2021], Ingraham et al. [2019]. Among which, AlphaFold 2 achieved outstanding performance in protein structure prediction Jumper et al. [2021], representing the state-of-the-art geometry-aware method. Our work is inspired from this groundbreaking work, adapting it from the intra-molecular structure prediction to the field of predicting the inter-molecular binding structure and binding affinity.
 Figure 1: Overview of TankBind Model. The whole protein is divided into blocks of radius $2 0 \mathring \mathrm { A }$ , each block is going through the TankBind model along with the drug compound. Both protein blocks and drug compound are modeled as graphs. The block-compound interaction matrix evolved multiple times with additional input based on the distance maps of the protein block and the compound through trigonometry module. Based on the updated interaction embedding, the model predicts the binding affinity of the compound to the blocks and the block-ligand distance maps. A constrastive loss function is used to ensure the native block binds stronger to the compound than decoys.
Drug-protein Interaction (DPI) prediction. The goal of DPI prediction is to illustrate the binding structure and binding affinity between protein and ligand. Apart from docking-based approaches Trott and Olson [2010], Friesner et al. [2004], prior machine learning-based works either use complex-free models to predict the binding affinity directly from protein-ligand pairs Wang and Dokholyan [2021], Li et al. [2020], Tsubaki et al. [2019], Gao et al. [2018], Karimi et al. [2019], Zheng et al. [2020] or make predictions through complex structure that has been previously obtained by experimental or docking approaches Jiménez et al. [2018], Lim et al. [2019], Morrone et al. [2020]. The former ones are less interpretable while the latter requires data involved in vast experimental costs and labour. More recently, EquiBind Stärk et al. [2022] takes a new approach by directly predicting the key points on both the protein and the compound, and aligning their key points through the ingeniously designed optimal transport loss. However, this method may generate compound structures clashing with the protein structures and currently lacks the capability to predict the binding affinity, limiting its use in drug discovery. In contrast, our approach has a trigonometry module imposing geometry constraints and a state-of-the-art binding affinity prediction capability.
# 3 TankBind Model
# 3.1 Overview of TankBind model
The general protocol of our model is shown in figure 1. The encoding of protein and compound is described in section 3.2. The rationale and implementation of trigonometry module is detailed in section 3.3. The design of loss functions for training is described in section 3.4. The generation of atom coordinates from predicted inter-molecular distance map is introduced in section 3.5.
# 3.2 Structural encoders of protein and drug
Our model input is the separate structures of a protein and a drug compound, both encoded as graphs. Indices $i , k$ always operate on the residue dimension, $j , k ^ { \prime }$ always on the compound dimension. $n$ is the number of protein nodes and $m$ is the number of compound nodes.
Protein. The protein is represented as a proximity 3D graph following Jing et al. [2020]. We denote the protein graph as $\mathcal G ^ { p } = \mathsf { \bar { ( } } \mathcal V ^ { p } , \mathcal E ^ { p } )$ , where each node $\bar { \mathfrak { v } } _ { i } ^ { p } \in \mathcal { V } ^ { p }$ corresponds to an amino acid, and has feature $\mathbf { h } _ { \mathfrak { v } ^ { p } } ^ { ( i ) }$ with both scalar and vector features. Each node also has a position $\mathbf { x } _ { i } ^ { p } \in \mathbb { R } ^ { 3 }$ equal to the Cartesian coordinate of $C _ { \alpha _ { i } }$ . An edge $\mathfrak { e } _ { i k } ^ { p }$ exists if $\mathfrak { v } _ { k } ^ { p }$ is among the 30 nearest neighbors of $\mathfrak { v } _ { i } ^ { p }$ . Each edge ${ \mathfrak { e } } _ { i k } ^ { p } \in { \mathcal { E } } ^ { p }$ also encodes both the scalar and the vector features. We then apply the geometric vector perceptrons (GVP) Jing et al. [2020, 2021] to embed the protein and arrive at feature $\mathbf { h } ^ { p } \in \mathbb { R } ^ { n \times s }$ after graph propagation, where $n$ is the number of nodes and $s$ is the embedding size.
To implicitly model side-chain flexibility, we choose a residue-level representation ignoring the finer details of protein structure, separating our method from other methods that use all-atoms or surface vertexes representation Jiang et al. [2021], Gainza et al. [2020]. Also, as shown by Jumper et al. [2021, 2018], residue-level embedding is enough to infer the side-chain conformation.
Motivated by protein co-evolution De Juan et al. [2013] and divide-and-conquer theory, the protein graph, $\mathcal G ^ { p }$ , is further divided into subgraphs $\mathcal { G } ^ { p ^ { \prime } }$ . Each subgraph $\mathcal G ^ { p ^ { \prime } }$ includes all the $\mathfrak { v } _ { i } ^ { p }$ and $\mathfrak { e } _ { i j } ^ { p }$ inside the functional block. The subgraph is denoted as $\mathcal { G } ^ { p ^ { \prime } } = ( \{ \mathfrak { v } _ { i } ^ { p } , \mathfrak { e } _ { i k } ^ { p } \} \ | \| \mathbf { x } _ { i } ^ { p } - \mathbf { x } _ { o } \| \leq 2 0 \mathring { \mathrm { A } }$ , $\| \mathbf { x } _ { k } ^ { p } - \mathbf { x } _ { o } \| \leq$ $2 0 \mathring \mathrm { A } )$ , where $\mathbf { x } _ { o }$ is the center of the functional block predicted by a widely-used ligand-agnostic method, P2rank (published in 2018)Krivák and Hoksza [2018]. Justification for the size of radius and use of P2rank is described in appendix G.
Drug compound. The drug compound is represented as a graph using TorchDrug toolkit Zhu et al. [2022]. The compound graph is denoted as $\mathcal G ^ { c } = ( \mathcal V ^ { c } , \mathcal E ^ { c } )$ where each node ${ \mathfrak { v } } _ { j } ^ { c } \in \mathcal { V } ^ { c }$ corresponds to a heavy atom (non-hydrogen atom), and has feature $\mathbf { h } _ { \mathfrak { v } ^ { c } } ^ { ( j ) }$ and each edge ${ \mathfrak { e } } _ { j k ^ { \prime } } ^ { c }$ has feature $\mathbf { h } _ { \mathfrak { e } ^ { c } } ^ { ( j k ^ { \prime } ) }$ . We use Graph Isomorphism Network (GIN) $\mathrm { X u }$ et al. [2018] to embed the compound and arrive at feature $\mathbf { h } ^ { c } \in \mathbb { R } ^ { m \times s }$ after graph propagation, where $m$ is the number of heavy atoms and $s$ is the embedding size.
# 3.3 Details of trigonometry module
The compound feature, $\mathbf { h } ^ { c }$ , and the protein block feature, $\mathbf { h } ^ { p }$ , are used to form the initial interaction embedding $\mathbf { z } ^ { ( 0 ) } \in \mathbb { R } ^ { n \times m \times s }$ , ${ \bf z } _ { i j } ^ { ( 0 ) } = { \bf h } _ { i } ^ { p } \odot { \bf h } _ { j } ^ { c }$ . The interaction embedding will be further updated with pair distance map of protein nodes, $D _ { i k } ^ { p } = \| \dot { \mathbf { x } } _ { i } ^ { p } - \mathbf { x } _ { k } ^ { p } \|$ and pair distance map of compound nodes, $D _ { j k ^ { \prime } } ^ { c } = \left\| \mathbf { x } _ { j } ^ { c } - \mathbf { x } _ { k ^ { \prime } } ^ { c } \right\|$ .
The rationale for including both the pair distance map of the protein nodes and the pair distance map of the compound nodes in updating the protein-compound interaction embedding is explained with two simplified examples. As shown in the upper part of figure 2, if a protein node A is in close proximity with compound node B, then compound node C will not be in contact with node A due to the large distance constraint between node B and C. Distance constraint between compound nodes B and D could also force a node $\mathrm { D }$ to be in close contact with protein node A.
To build this observation of trigonometry constraints into our model, we design the following module to update the interaction embedding, in layer $\ell .$ , $\bar { \forall } ( i , j )$ :
 Figure 2: Rationale for including trigonometry module. Upper: Protein node in square, compound nodes in circles. Lower: Trigonometry module ensures that the interaction between protein node $i$ and compound node $j$ depends on all protein and compound nodes $k , k ^ { \prime }$ .
$$\widetilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } = \mathbf { z } _ { i j } ^ { ( \ell ) } + \Phi \big ( \sum _ { k = 1 } ^ { n } \mathbf { p } _ { i k } \mathbf { t } _ { k j } ^ { ( \ell ) } + \sum _ { k ^ { \prime } = 1 } ^ { m } \mathbf { t } _ { i k ^ { \prime } } ^ { \prime ( \ell ) } \mathbf { c } _ { k ^ { \prime } j } \big ) \odot \mathbf { g } \big ( \mathbf { z } _ { i j } ^ { ( \ell ) } \big )$$
where $\mathbf { p } _ { i k } = \phi ( D _ { i k } ^ { p } )$ is the linear embedding of encoded pair distance between protein nodes. $\mathbf { p } \in$ $\mathbb { R } ^ { n \times n \times s }$ , $n$ is the number of nodes in protein block, $s$ is the embedding size. ${ \bf c } _ { j k ^ { \prime } } = \phi ( D _ { j k ^ { \prime } } ^ { c } )$ is the linear embedding of encoded pair distance between compound nodes. $\mathbf { c } \in \mathbb { R } ^ { m \times m \times s }$ , $m$ is the number of compound nodes. t(ℓ)ij and t′(ℓ)ij are the same gated linear transformations of $\mathbf { z } _ { i j } ^ { ( \ell ) }$ but with nonared parameters, $\mathbf t _ { i j } ^ { ( \ell ) } = \mathrm { L i n e a r } ( \mathbf z _ { i j } ^ { ( \ell ) } ) \odot \mathbf { g } ( \mathbf z _ { i j } ^ { ( \ell ) } ) , \mathbf t ^ { ( \ell ) } \in \mathbb { R } ^ { n \times m \times s } , \mathbf { g } ( \mathbf z _ { i j } ^ { ( \ell ) } ) = \mathrm { s i g m o i d } ( \mathrm { L i n e a r } ( \mathbf z _ { i j } ^ { ( \ell ) } ) ) ,$ $\Phi$ is a layernorm function followed by a linear transformation.
Another type of physical constraint need to be take into consideration is the excluded-volume (Van Der Waals) and saturation effect. As shown in the upper figure 2, if protein node A forms a strong interaction, hydrogen bonding for example, with compound node B, then node $\mathbf { D }$ is unlikely to form the same type of interaction with node A because node A has limited number of hydrogen donors or acceptors. To account for these effects, we designed a self-attention module to modulate the interaction between a protein node and all compound nodes by taking the whole interaction between this protein node and all compound nodes into consideration.
$$\begin{array} { r l } & { \dot { \mathbf { z } } _ { i j } ^ { ( \ell ) } = \tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } + \Phi ( \mathrm { c o n c a t } _ { h } \big ( \displaystyle \sum _ { k ^ { \prime } = 1 } ^ { m } ( w _ { i j k ^ { \prime } } ^ { ( \ell ) h } \mathbf { v } _ { i k ^ { \prime } } ^ { ( \ell ) h } ) \odot \mathbf { g } ^ { h } ( \tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } ) \big ) ) } \\ & { w _ { i j k ^ { \prime } } ^ { ( \ell ) h } = \mathrm { s o f t m a x } _ { k ^ { \prime } } ( \mathbf { q } _ { i j } ^ { ( \ell ) h ^ { \top } } \mathbf { k } _ { i k ^ { \prime } } ^ { ( \ell ) h } ) } \end{array}$$
, where q(ℓ)ij $\mathbf { q } _ { i j } ^ { ( \ell ) h } , \mathbf { k } _ { i j } ^ { ( \ell ) h } , \mathbf { v } _ { i j } ^ { ( \ell ) h }$ are linear transformation of $\tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) }$ , $h$ is number of attention heads. Function $\mathbf { g } ^ { h }$ is the standard $\mathbf { g }$ with reshaping the embedding into heads at the end, is a linear transformation.
Lastly, a non-linear transition module is added to transit the interaction embedding to the next layer through multilayer perceptron, z(ℓij $\mathbf z _ { i j } ^ { ( \ell + 1 ) } = \mathbf { M L P } ( \dot { \mathbf z } _ { i j } ^ { ( \ell ) } )$ . The whole trigonometry module is composed of three consecutive parts, the trigonometry update, the self-attention modulation, and the non-linear transition module. Layernorm is applied on every input $\mathbf { z } _ { i j } ^ { ( \ell ) }$ and a $25 \%$ dropout is applied to the trigonometry update and self-attention modulation during training. The final outputs, drug-protein binding affinity, $\begin{array} { r } { \hat { a } = \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } } \end{array}$ Linear $( \mathbf { z } _ { i j } ^ { ( L ) } )$ , and inter-molecular distance map, Dpredij = $D _ { i j } ^ { p r e d } = \mathbf { g } ( \mathbf { z } _ { i j } ^ { ( L ) } ) \mathrm { L i n e a r } ( \mathbf { z } _ { i j } ^ { ( L ) } )$ , are predicted directly based on the last layer embedding $\mathbf { z } _ { i j } ^ { ( L ) }$ , where $L$ is the number of module stacks.
# 3.4 Design of binding interaction and affinity loss functions
Many previous works model the interaction between compound and protein by only preserving the interaction region, residues that far away are ignored Townshend et al. [2020], Méndez-Lucio et al. [2021]. On the positive side, the computation and memory demand for characterize the interaction between protein and the drug compound is greatly reduced by focusing on regional interaction. But the fact of not binding to alternative binding sites is also a valuable information. By the nature of crystallization, if a protein-compound complex could be successfully crystallized, other possible binding sites on this protein definitely bind less strongly than the native binding site to the compound, therefore, those other binding sites could be used as high-valued decoys. Based on this observation, we designed a max-margin constrastive affinity loss, equation 4, following the idea of Hadsell et al. [2006]. Such that the compound’s predicted affinity, $\hat { a }$ , to the decoys is less than the experimentally measured affinity, $a$ , by a margin value, $\epsilon$ .
$$\mathcal { L } _ { \mathrm { a f f i n i t y } } ( \hat { a } _ { \zeta } , a ) = \mathbb { 1 } ( \zeta ) ( \hat { a } _ { \zeta } - a ) ^ { 2 } + ( 1 - \mathbb { 1 } ( \zeta ) ) \operatorname* { m a x } ( 0 , \hat { a } _ { \zeta } - ( a - \epsilon ) ) ^ { 2 }$$
where $\hat { a } _ { \zeta }$ is the predicted affinity to block $\zeta$ , and indicator function $\mathbb { 1 } ( \zeta ) = 1$ when block $\zeta$ encloses the native ligand, and $\mathbb { 1 } ( \zeta ) = 0$ otherwise. We, therefore, take full use of information stored in the whole protein instead of only the native binding region. We also include a mean squared erorr (MSE) loss for native interaction distance map, $\begin{array} { r } { \mathcal { L } _ { \mathrm { d i s t a n c e } } = \mathbb { 1 } ( \zeta ) \frac { 1 } { n m } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } ( D _ { i j } ^ { p r e d } - D _ { i j } ) ^ { 2 } } \end{array}$ . The overall training objective of TankBind is: $\mathcal { L } = \mathcal { L } _ { \mathrm { a f f u n i t y } } + \mathcal { L } _ { \mathrm { d i s t a n c t } }$ e .
# 3.5 Generation of drug coordinates based on predicted inter-molecular distance map.
The Cartesian coordinates, $\big \{ \hat { \mathbf { x } } _ { j } ^ { c } \big \}$ , of the heavy atoms of a drug compound could be deduced analytically based on the predicted inter-molecular distance matrix, $D _ { i j } ^ { p r e d }$ , the coordinates of protein nodes, $\{ \mathbf { x } _ { i } ^ { p } \}$ , and the pair distance matrix of compound nodes, $D _ { j k ^ { \prime } } ^ { c }$ Masters et al. [2022], Hoffmann and Noé [2019]. But since predicted distance matrix contains noise, we take a numerical approach Masters et al. [2022], Zsoldos et al. [2007]. By minimizing the total loss, $\mathcal { L } _ { \mathrm { g e n e r a t i o n } }$ , which consists of two parts, the interaction loss and the compound configuration loss, we could derive the coordinates
Table 1: Blind self-docking. All models take a pair of ligand structure (generated by RDKit) and protein structure as input, trying to predict the atom coordinates of the ligand after binding. In blind docking, the protein binding site is assumed unknown. Test set is composed of 363 protein-ligand structure crystallized after 2019 curated by PDBbind database. Details about model runtime and the number of model parameters are in appendix C
<table><tr><td></td><td colspan="4">Ligand RMSD Percentiles ↓</td><td colspan="2">% Below Threshold</td><td colspan="4">Centroid Distance Percentiles↓</td><td colspan="2">% Below Threshold 个</td></tr><tr><td>Methods</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>个 5A</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td></tr><tr><td>QVINA-W</td><td>2.5</td><td>7.7</td><td>23.7</td><td>13.6</td><td>20.9</td><td>40.2</td><td>0.9</td><td>3.7</td><td>22.9</td><td>11.9</td><td>41.0</td><td>54.6</td></tr><tr><td>GNINA</td><td>2.8</td><td>8.7</td><td>22.1</td><td>13.3</td><td>21.2</td><td>37.1</td><td>1.0</td><td>4.5</td><td>21.2</td><td>11.5</td><td>36.0</td><td>52.0</td></tr><tr><td>SMINA</td><td>3.8</td><td>8.1</td><td>17.9</td><td>12.1</td><td>13.5</td><td>33.9</td><td>1.3</td><td>3.7</td><td>16.2</td><td>9.8</td><td>38.0</td><td>55.9</td></tr><tr><td>GLIDE(c.)</td><td>2.6</td><td>9.3</td><td>28.1</td><td>16.2</td><td>21.8</td><td>33.6</td><td>0.8</td><td>5.6</td><td>26.9</td><td>14.4</td><td>36.1</td><td>48.7</td></tr><tr><td>VINA</td><td>5.7</td><td>10.7</td><td>21.4</td><td>14.7</td><td>5.5</td><td>21.2</td><td>1.9</td><td>6.2</td><td>20.1</td><td>12.1</td><td>26.5</td><td>47.1</td></tr><tr><td>EQUIBIND-U</td><td>3.3</td><td>5.7</td><td>9.7</td><td>7.8</td><td>7.2</td><td>42.4</td><td>1.3</td><td>2.6</td><td>7.4</td><td>5.6</td><td>40.0</td><td>67.5</td></tr><tr><td>EQUIBIND</td><td>3.8</td><td>6.2</td><td>10.3</td><td>8.2</td><td>5.5</td><td>39.1</td><td>1.3</td><td>2.6</td><td>7.4</td><td>5.6</td><td>40.0</td><td>67.5</td></tr><tr><td>TANKBind-R</td><td>2.8</td><td>5.2</td><td>11.2</td><td>9.4</td><td>16.0</td><td>47.9</td><td>1.0</td><td>2.3</td><td>7.7</td><td>7.3</td><td>44.9</td><td>69.4</td></tr><tr><td>TANKBind-C</td><td>2.4</td><td>4.5</td><td>8.4</td><td>8.2</td><td>19.6</td><td>54.8</td><td>0.9</td><td>1.9</td><td>5.4</td><td>6.3</td><td>53.2</td><td>73.3</td></tr><tr><td>TANKBind-P</td><td>2.6</td><td>4.5</td><td>8.1</td><td>8.5</td><td>16.3</td><td>54.0</td><td>0.9</td><td>1.9</td><td>5.2</td><td>6.4</td><td>53.2</td><td>74.4</td></tr><tr><td>TANKBind</td><td>2.4</td><td>4.0</td><td>7.7</td><td>7.4</td><td>19.3</td><td>61.7</td><td>0.9</td><td>1.7</td><td>4.2</td><td>5.5</td><td>56.5</td><td>77.4</td></tr></table>
of the docked drug coordinates, $\big \{ \hat { \mathbf { x } } _ { j } ^ { c } \big \}$
$$\mathcal { L } _ { \mathrm { g e n e r a t i o n } } = \mathcal { L } _ { \mathrm { i n t e r a c i o n } } + \mathcal { L } _ { \mathrm { c o n f i g u r a t i o n } } = \sum _ { i } ^ { n } \sum _ { j } ^ { m } ( | \hat { D } _ { i j } - D _ { i j } ^ { p r e d } | ) + \sum _ { j } ^ { m } \sum _ { k ^ { \prime } } ^ { m } ( | \hat { D } _ { j k ^ { \prime } } ^ { c } - D _ { j k ^ { \prime } } ^ { c } | )$$
$$\hat { D } _ { i j } = \big \| \mathbf x _ { i } ^ { p } - \hat { \mathbf x } _ { j } ^ { c } \big \| , \hat { D } _ { j k ^ { \prime } } ^ { c } = \big \| \hat { \mathbf x } _ { j } ^ { c } - \hat { \mathbf x } _ { k ^ { \prime } } ^ { c } \big \|$$
where $n$ is the number of protein nodes, and $m$ is number of compound nodes, and $\{ \mathbf { x } _ { j } ^ { p } \}$ are the Cartesian coordinates of protein nodes. All inter-molecular distances are clamped to have an upper bound of $1 0 \mathring \mathrm { A }$ to focus on the direct interaction. In self-docking setting, when the compound configuration is unknown, we add a local atomic structures (LAS) maskflexibility while enforcing basic geometric constraint, $\begin{array} { r } { \mathcal { L } _ { \mathrm { c o n f i g u r a t i o n } } = \sum _ { j } ^ { m } \sum _ { k ^ { \prime } } ^ { m } \mathbb { 1 } ( j , k ^ { \prime } ) ( | \hat { D } _ { j k ^ { \prime } } ^ { c } - D _ { j k ^ { \prime } } ^ { c } | ) } \end{array}$ where $\mathbb { 1 } ( j , k ^ { \prime } ) = 1$ when compound atom $j$ and are connected by connected by a bond, or 2-hop away, or in the same ring structure, and $\mathbb { 1 } ( j , k ^ { \prime } ) = 0$ otherwise Stärk et al. [2022], Trott and Olson [2010]. For every test protein-ligand pair, TankBind predicts the binding affinity of the ligand to all segmented functional blocks and chooses the one with strongest affinity to generate the binding structures.
# 4 Evaluation
# 4.1 Protein-ligand binding structure prediction
Dataset. We used publicly available PDBbind v2020 dataset Liu et al. [2015] which has the structures of 19443 protein-ligand complexes along with their experimentally measured binding affinity. PDBbind is a database curated based on the Protein Data Bank (PDB) Burley et al. [2021]. We followed the same time split as defined in EquiBind paper Stärk et al. [2022] in which the training and validation data are the protein-ligand complex structures deposited before 2019 and the test set is the structures deposited after 2019. After removing a few structures that unable to process using RDKit from the training set, we had 17787 structures for training, 968 for validation and 363 for testingLandrum et al. [2013]. We also reduced the possibility of encountering equally valid binding sites by removing chains that have no atom within $1 0 \mathring \mathrm { A }$ from any atom of the ligand following the protocol described in Stärk et al. [2022].
Baselines. We compared TankBind with the most widely-used docking method AutoDock VinaTrott and Olson [2010] and the recent proposed geometry-based DL method EquiBind Stärk et al. [2022]. We also included four popular docking methods QVina-W, GINAMcNutt et al. [2021], SMINAKoes et al. [2013] and GLIDEFriesner et al. [2004] as listed in Stärk et al. [2022].
Table 2: Blind self-docking for unseen receptors. All models evaluated on 142 crystallized proteincompound structures where the proteins have not been observed in training set.
<table><tr><td rowspan="3"></td><td colspan="4">Ligand RMSD Percentiles ↓</td><td colspan="2">%Below</td><td colspan="4">Centroid Distance Percentiles ↓</td><td rowspan="2" colspan="2">% Below Threshold</td></tr><tr><td colspan="4"></td><td colspan="2">个 Threshold</td><td colspan="4"></td></tr><tr><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td></tr><tr><td>QVINA-W</td><td>3.4</td><td>10.3</td><td>28.1</td><td>16.9</td><td>15.3</td><td>31.9</td><td>1.3</td><td>6.5</td><td>26.8</td><td>15.2</td><td>35.4</td><td>47.9</td></tr><tr><td>GNINA</td><td>4.5</td><td>13.4</td><td>27.8</td><td>16.7</td><td>13.9</td><td>27.8</td><td>2.0</td><td>10.1</td><td>27.0</td><td>15.1</td><td>25.7</td><td>39.5</td></tr><tr><td>SMINA</td><td>4.8</td><td>10.9</td><td>26.0</td><td>15.7</td><td>9.0</td><td>25.7</td><td>1.6</td><td>6.5</td><td>25.7</td><td>13.6</td><td>29.9</td><td>41.7</td></tr><tr><td>GLIDE</td><td>3.4</td><td>18.0</td><td>31.4</td><td>19.6</td><td>19.6</td><td>28.7</td><td>1.1</td><td>17.6</td><td>29.1</td><td>18.1</td><td>29.4</td><td>40.6</td></tr><tr><td>VINA</td><td>7.9</td><td>16.6</td><td>27.1</td><td>18.7</td><td>1.4</td><td>12.0</td><td>2.4</td><td>15.7</td><td>26.2</td><td>16.1</td><td>20.4</td><td>37.3</td></tr><tr><td>EQUIBIND-U</td><td>5.7</td><td>8.8</td><td>14.1</td><td>11.0</td><td>1.4</td><td>21.5</td><td>2.6</td><td>6.3</td><td>12.9</td><td>8.9</td><td>16.7</td><td>43.8</td></tr><tr><td>EQUIBIND</td><td>5.9</td><td>9.1</td><td>14.3</td><td>11.3</td><td>0.7</td><td>18.8</td><td>2.6</td><td>6.3</td><td>12.9</td><td>8.9</td><td>16.7</td><td>43.8</td></tr><tr><td>TANKBind-R</td><td>3.6</td><td>6.9</td><td>17.0</td><td>12.6</td><td>5.6</td><td>35.2</td><td>1.3</td><td>3.6</td><td>15.7</td><td>10.3</td><td>35.2</td><td>58.5</td></tr><tr><td>TANKBind-C</td><td>3.4</td><td>5.5</td><td>9.8</td><td>9.9</td><td>9.2</td><td>43.0</td><td>1.1</td><td>2.6</td><td>8.1</td><td>7.9</td><td>46.5</td><td>65.5</td></tr><tr><td>TANKBind-P</td><td>3.3</td><td>5.5</td><td>10.9</td><td>11.2</td><td>5.6</td><td>45.1</td><td>1.3</td><td>2.3</td><td>7.9</td><td>9.1</td><td>47.9</td><td>66.9</td></tr><tr><td>TANKBind</td><td>2.9</td><td>4.7</td><td>8.8</td><td>9.1</td><td>4.9</td><td>55.6</td><td>1.3</td><td>2.3</td><td>4.8</td><td>7.0</td><td>45.1</td><td>75.4</td></tr></table>
Evaluation metrics. We follow prior work Stärk et al. [2022] and use ligand root-mean-square deviation (RMSD) of atomic positions and centroid distance to compare predicted binding structures with ground-truths. The Ligand RMSD calculates the normalized Frobenius norm of the two corresponding matrices of ligand coordinates. The centroid distance is defined as the the distance between the averaged 3D coordinates of the predicted and ground-truth bound ligand atoms, indicating the model capability of identifying correct binding region. Hydrogens are not involved in the calculation.
Performance in blind flexible self-docking We start with a real-world blind self-docking experiment, in which the ligand conformation is not fixed, and the result of re-docking experiment, in which the native ligand conformation is given, is reported in Appendix A. As shown in the table 1, TankBind achieves state-of-the-art performance, outperforming geometry DL-based model EquiBind. This advantage is particularly evident in the top $2 5 \%$ and top $50 \%$ ligand RMSD, which allows our method to predict $22 \%$ more qualified (below Threshold $5 \mathring \mathrm { A }$ ) binding poses than EquiBind. This results are also consistent in the metrics of centroid distance, demonstrating that our method also has a clear advantage in the identification of binding region. Even though GLIDE (commercial) and Autodock Vina are established docking software with more than a decade of continuous development, our model remarkably frequently outperforms them. At the same time, we are orders of magnitude faster than them, and on the same level as EquiBind (Appendix C). In addition, we explore the possible of TankBind-R, where we randomly segment the protein, TankBind-P, where we only doing the summation over protein nodes in equation 1, and TankBind-C, where we only sum over compound nodes. The performance reduction on the these variants supports our view that trigonometry message passing between proteins and ligand and segmentation choice are critical to the prediction of binding structures.
Performance in self-docking unseen protein We next focus on the new protein setting, in which the tested proteins have not been observed in the training set. Table 2 shows that Tankbind leads to larger improvements over EquiBind and docking methods with regard to ligand-RMSD and centriod distance.This is in line with our expectation that TankBind has better generalization ability due to the physical-inspired trigonometry module and explicit consideration of conservative functional blocks. In this setting, as shown in Figure 3 and table 2, for fractions smaller than $2 \mathring \mathrm { A }$ , 5Å and $1 5 \mathring \mathrm { A }$ , the performance between EquiBind and other docking method are comparable, while TankBind is always better by a large margin, further confirming the effectiveness of our method and indicating that the proposed strategy has practical values for the virtual screening of new proteins.
 Figure 3: Estimator of the Cumulative Distribution Function (ECDF) plot for ligand RMSD (left) and Centroid Distance (right) from result evaluated on new receptors subset. The x axis of the figure stops at $1 5 \mathring \mathrm { A }$ because comparison for larger RMSD is less meaningful when the predicted location of the ligand is away from the true binding site, a RMSD of $1 5 \mathring \mathrm { A }$ is not better than RMSD of $5 0 \mathring \mathrm { A }$ .
<table><tr><td>Methods</td><td colspan="3">Ligand↓Centroid↓Below2A↑Below5A↑</td></tr><tr><td>w/o P2Rank</td><td>9.37</td><td>7.30 44.90</td><td>69.42</td></tr><tr><td>w/o Trig</td><td>8.73</td><td>6.44 44.08</td><td>74.93</td></tr><tr><td>TAPE</td><td>8.81</td><td>6.89 50.69</td><td>73.00</td></tr><tr><td>GAT</td><td>8.27</td><td>6.23 56.47</td><td>78.51</td></tr><tr><td>TankBind-P</td><td>8.47</td><td>6.44 53.17</td><td>74.38</td></tr><tr><td>TankBind-C</td><td>8.20 6.27</td><td>53.17</td><td>73.28</td></tr><tr><td>Origin</td><td>7.43</td><td>5.51 56.47</td><td>77.41</td></tr></table>
Table 4: Ablation results. We listed four main metrics here, a complete table is in appendix E
<table><tr><td>Methods</td><td colspan="3">RMSE↓Pearson↑Spearman↑MAE↓</td></tr><tr><td>TransCPI</td><td>1.741 0.576</td><td>0.540</td><td>1.404</td></tr><tr><td>MONN</td><td>1.438 0.624</td><td>0.589</td><td>1.143</td></tr><tr><td>PIGNet※</td><td>2.640 0.511</td><td>0.489</td><td>2.110</td></tr><tr><td>IGN</td><td>1.433 0.698</td><td>0.641</td><td>1.169</td></tr><tr><td>HOLOPROT</td><td>1.546 0.602</td><td>0.571</td><td>1.208</td></tr><tr><td>STAMPDPI</td><td>1.658 0.545</td><td>0.411</td><td>1.325</td></tr><tr><td>TANKBind</td><td>1.346 0.726</td><td>0.703</td><td>1.070</td></tr></table>
Table 3: Binding affinity prediction. TankBind achieves SOTA on all four metrics.
# 4.2 Protein-ligand binding affinity prediction
TankBind is also capable of predicting protein-ligand binding affinity because of the constrastive affinity loss function. Since we segmented the whole protein into protein blocks, the predicted binding affinity of ligand to the whole protein is equal to the binding affinity to the one protein block that predicted to bind strongest with the ligand. To demonstrate the ability, we compared TankBind with the state-of-the-art binding affinity prediction models.
Dataset. We split the dataset into training, test and validation splits based on the same time split described earlier. The experimentally measured affinity data in PDBbind dataset has three different names, depending on the exact experiment setups, $50 \%$ inhibiting concentration (IC50), inhibition constant $( K _ { i } )$ , and dissociation constant $( K _ { D } )$ , all converted to the unit of molar concentration. Similar to previous methods Somnath et al. [2021], Townshend et al. [2020], we predict negative log-transformed binding affinity.
Baselines and evaluation metrics. We compare TankBind against two state-of-the-art sequencebased methods, TransformerCPI Chen et al. [2020b] and MONN Li et al. [2020], two complex-based methods, IGN Jiang et al. [2021] and PIGNet Moon et al. [2022] both requiring prior knowledge of the inter-molecular structure to predict affinity, and two structure-based methods, HOLOPTOT Somnath et al. [2021] and STAMPDPI Wang et al. [2022]. For evaluating various methods, we use four metrics – root mean squared error (RMSE), Pearson correlation coefficient, Spearman correlation coefficient and mean absolute error (MAE). We also include the mean and standard deviation across 3 experimental runs in appendix D.
 Figure 4: (a) An example of TankBind identifying an unseen binding site. The protein is shown in white, co-crystallized compounds of three PDBs in the training set is shown in purple. The ligand of 6K1S is shown in green. TankBind is able to find this correct pose for the compound, shown in red, while the other two, Vina in orange, and Equibind in cyan, place the compound away from the true binding site. (b) For PDB 6QRG, both protein and compound have not been seen in the training set. But TankBind still find the correct pose. Crystallized ligand colored in green, TankBind prediction in red, EquiBind in cyan and Vina result in organ.
Result As shown in Table 3, our model obtains the best performance in PDBbind test set, consistently outperforms SOTA binding affinity prediction methods. Note that even without the prior interaction information, TankBind also achieves better result than complex-based methods (PIGNET and IGN), proving that the predicted binding structural information provided considerable gain to the affinity prediction task.
# 4.3 Ablation study
We conducted ablation studies to investigate factors that influence the performance of proposed TankBind framework. As shown in Table 4, the original version of TankBind with the trigonometry message passing between protein and ligand shows the best performance among all architectures. Replacing the P2rank with a randomly split of blocks performed the worst, which verifies our hypothesis that functional block segmentation can improve generalization. Simple architecture substitutions for protein (TAPE) Rao et al. [2019] and molecular representation (GAT) Velickovi ˇ c´ et al. [2017] decrease slightly the model performance. Replacing the intra-trigonometry module with the uni-modal variants (TankBind-P and TankBind-C) both caused noticeable decreases in performances.
# 4.4 Case studies
TankBind correctly identifies an unseen binding site for a new drug compound. As a representative case, in PDB 6K1S, a seen protein binds to a new drug compound at a site that has not been observed before. This protein has three co-crystallized complex structures in the training set, PDB 4X60, 4X61, 4X63. As shown in the left of figure 4, our method, shown in red, aligns well with the true ligand, shown in green, despite our method has never seen any compound locates at this site before. While other two methods, EquiBind in cyan, Vina in orange identify an incorrect site for this compound. Packages Kalign, Biopython, and Smith-Waterman library are used to systematically analyze the results Lassmann [2020], Cock et al. [2009], Li et al. [2020], Zhao et al. [2013] (see Appendix H).
TankBind finds the correct pose when both compound and protein are unseen. We picked two representative examples with both compound and protein are unseen, one, PDB 6QRG, in the right of figure 4 and another, PDB 6KQI, in appendix B. Both PDB 6QRG and PDB 6KQI have max protein similarity below 0.8 (6QRG 0.78, 6KQI 0.57), and max compound similarity below 0.4 (6QRG 0.36, 6KQI 0.27).
# 5 Conclusion
In this work, we propose a novel binding structure and affinity prediction model, TankBind, that builds trigonometry constraints into the model and explicitly attends to all possible binding sites by segmenting the whole protein into functional blocks. We observe significant improvements on task of binding structure prediction over existing deep learning methods: a $22 \%$ increase in the fraction of prediction below $\bar { 5 } \mathring { \mathrm { A } }$ in ligand RMSD, and a $42 \%$ increase when the proteins have not been observed in the training set. Moreover, we demonstrate that the model is able to predict affinity and outperform SOTA methods on PDBbind. This work opens a new direction for modelling the inter-molecular interaction between protein and drug molecule. Numerous directions for further exploration include incorporating a ligand conformer generation module, enhancing the dataset with AlphaFold-predicted structure and public available SAR data, integrating the segmentation of functional block in an end-to-end manner, and combining the model with protein backbone dynamics modeling to handle larger scale conformation changes induced by drug-protein interactions.
# Acknowledgments and Disclosure of Funding
We thank Prof.Yuedong Yang, Dr.Leilei Shi, Dr. Jiahui Tong for their helpful discussions; Penglei Wang for his support in binding affinity experiments; Meihui Song for her support in figure drawing. We thank the Guangzhou National Supercomputer Center for providing computational source. S. $\textsf { Z }$ acknowledges support from the National Key R&D Program of China (2020YFB0204803) and National Natural Science Foundation of China (21773313 and 61772566).
# References
Michael S Kinch, Zachary Kraft, and Tyler Schwartz. 2021 in review: Fda approvals of new medicines. Drug discovery today, 2022.
Subramanian Boopathi, Adolfo B Poma, and Ponmalai Kolandaivel. Novel 2019 coronavirus structure, mechanism of action, antiviral drug promises and rule out against its treatment. Journal of Biomolecular Structure and Dynamics, 39(9):3409–3418, 2021.
Lei Xie, Li Xie, and Philip E Bourne. Structure-based systems biology for analyzing off-target binding. Current opinion in structural biology, 21(2):189–199, 2011.
Zhihai Liu, Yan Li, Li Han, Jie Li, Jie Liu, Zhixiong Zhao, Wei Nie, Yuchen Liu, and Renxiao Wang. Pdb-wide collection of binding data: current status of the pdbbind database. Bioinformatics, 31(3): 405–412, 2015.
Jean-Louis Reymond, Ruud Van Deursen, Lorenz C Blum, and Lars Ruddigkeit. Chemical space as a source for new drugs. MedChemComm, 1(1):30–38, 2010.
Elena A Ponomarenko, Ekaterina V Poverennaya, Ekaterina V Ilgisonis, Mikhail A Pyatnitskiy, Arthur T Kopylov, Victor G Zgoda, Andrey V Lisitsa, and Alexander I Archakov. The size of the human proteome: the width and depth. International journal of analytical chemistry, 2016, 2016.
Oleg Trott and Arthur J Olson. Autodock vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of computational chemistry, 31(2):455–461, 2010.
Richard A Friesner, Jay L Banks, Robert B Murphy, Thomas A Halgren, Jasna J Klicic, Daniel T Mainz, Matthew P Repasky, Eric H Knoll, Mee Shelley, Jason K Perry, et al. Glide: a new approach for rapid, accurate docking and scoring. 1. method and assessment of docking accuracy. Journal of medicinal chemistry, 47(7):1739–1749, 2004.
Suzanne Ackloo, Rima Al-awar, Rommie E Amaro, Cheryl H Arrowsmith, Hatylas Azevedo, Robert A Batey, Yoshua Bengio, Ulrich AK Betz, Cristian G Bologa, John D Chodera, et al. Cache (critical assessment of computational hit-finding experiments): A public–private partnership benchmarking initiative to enable the development of computational methods for hit-finding. Nature Reviews Chemistry, pages 1–9, 2022.
Francesco Gentile, Jean Charle Yaacoub, James Gleave, Michael Fernandez, Anh-Tien Ton, Fuqiang Ban, Abraham Stern, and Artem Cherkasov. Artificial intelligence–enabled virtual screening of ultra-large chemical libraries with deep docking. Nature Protocols, pages 1–26, 2022.
Amy C Anderson. The process of structure-based drug design. Chemistry & biology, 10(9):787–797, 2003.
Ajay N Jain. Scoring functions for protein-ligand docking. Current Protein and Peptide Science, 7 (5):407–420, 2006.
John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021.
Mingchen Chen, Xun Chen, Nicholas P Schafer, Cecilia Clementi, Elizabeth A Komives, Diego U Ferreiro, and Peter G Wolynes. Surveying biomolecular frustration at atomic resolution. Nature communications, 11(1):1–9, 2020a.
José Nelson Onuchic, Zaida Luthey-Schulten, and Peter G Wolynes. Theory of protein folding: the energy landscape perspective. Annual review of physical chemistry, 48(1):545–600, 1997.
David De Juan, Florencio Pazos, and Alfonso Valencia. Emerging methods in protein co-evolution. Nature Reviews Genetics, 14(4):249–261, 2013.
Fabian Glaser, Tal Pupko, Inbal Paz, Rachel E Bell, Dalit Bechor-Shental, Eric Martz, and Nir BenTal. Consurf: identification of functional regions in proteins by surface-mapping of phylogenetic information. Bioinformatics, 19(1):163–164, 2003.
Minkyung Baek, Frank DiMaio, Ivan Anishchenko, Justas Dauparas, Sergey Ovchinnikov, Gyu Rie Lee, Jue Wang, Qian Cong, Lisa N Kinch, R Dustin Schaeffer, et al. Accurate prediction of protein structures and interactions using a three-track neural network. Science, 373(6557):871–876, 2021.
Bowen Jing, Stephan Eismann, Pratham N Soni, and Ron O Dror. Equivariant graph neural networks for 3d macromolecular structure. arXiv preprint arXiv:2106.03843, 2021.
Octavian-Eugen Ganea, Xinyuan Huang, Charlotte Bunne, Yatao Bian, Regina Barzilay, Tommi Jaakkola, and Andreas Krause. Independent se (3)-equivariant models for end-to-end rigid protein docking. arXiv preprint arXiv:2111.07786, 2021.
Wengong Jin, Jeremy Wohlwend, Regina Barzilay, and Tommi Jaakkola. Iterative refinement graph neural network for antibody sequence-structure co-design. arXiv preprint arXiv:2110.04624, 2021.
John Ingraham, Vikas Garg, Regina Barzilay, and Tommi Jaakkola. Generative models for graphbased protein design. Advances in Neural Information Processing Systems, 32, 2019.
Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. Cell systems, 8(4): 292–301, 2019.
Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 30, 2017.
Vignesh Ram Somnath, Charlotte Bunne, and Andreas Krause. Multi-scale representation learning on proteins. Advances in Neural Information Processing Systems, 34, 2021.
Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, pages 9558–9568. PMLR, 2021.
Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. arXiv preprint arXiv:2203.02923, 2022.
Oscar Méndez-Lucio, Mazen Ahmad, Ehecatl Antonio del Rio-Chanona, and Jörg Kurt Wegner. A geometric deep learning approach to predict binding conformations of bioactive molecules. Nature Machine Intelligence, 3(12):1033–1039, 2021.
Jian Wang and Nikolay V Dokholyan. Yuel: Compound-protein interaction prediction with high generalizability. bioRxiv, 2021.
Shuya Li, Fangping Wan, Hantao Shu, Tao Jiang, Dan Zhao, and Jianyang Zeng. Monn: a multiobjective neural network for predicting compound-protein interactions and affinities. Cell Systems, 10(4):308–322, 2020.
Masashi Tsubaki, Kentaro Tomii, and Jun Sese. Compound–protein interaction prediction with end-to-end learning of neural networks for graphs and sequences. Bioinformatics, 35(2):309–318, 2019.
Kyle Yingkai Gao, Achille Fokoue, Heng Luo, Arun Iyengar, Sanjoy Dey, and Ping Zhang. Interpretable drug target prediction using deep neural representation. In IJCAI, volume 2018, pages 3371–3377, 2018.
Mostafa Karimi, Di Wu, Zhangyang Wang, and Yang Shen. Deepaffinity: interpretable deep learning of compound–protein affinity through unified recurrent and convolutional neural networks. Bioinformatics, 35(18):3329–3338, 2019.
Shuangjia Zheng, Yongjian Li, Sheng Chen, Jun Xu, and Yuedong Yang. Predicting drug–protein interaction using quasi-visual question answering system. Nature Machine Intelligence, 2(2): 134–140, 2020.
José Jiménez, Miha Skalic, Gerard Martinez-Rosell, and Gianni De Fabritiis. K deep: protein–ligand absolute binding affinity prediction via 3d-convolutional neural networks. Journal of chemical information and modeling, 58(2):287–296, 2018.
Jaechang Lim, Seongok Ryu, Kyubyong Park, Yo Joong Choe, Jiyeon Ham, and Woo Youn Kim. Predicting drug–target interaction using a novel graph neural network with 3d structure-embedded graph representation. Journal of chemical information and modeling, 59(9):3981–3988, 2019.
Joseph A Morrone, Jeffrey K Weber, Tien Huynh, Heng Luo, and Wendy D Cornell. Combining docking pose rank and structure with deep learning improves protein–ligand binding mode prediction over a baseline docking approach. Journal of chemical information and modeling, 60(9): 4170–4179, 2020.
Hannes Stärk, Octavian-Eugen Ganea, Lagnajit Pattanaik, Regina Barzilay, and Tommi Jaakkola. Equibind: Geometric deep learning for drug binding structure prediction. arXiv preprint arXiv:2202.05146, 2022.
Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael JL Townshend, and Ron Dror. Learning from protein structure with geometric vector perceptrons. arXiv preprint arXiv:2009.01411, 2020.
Dejun Jiang, Chang-Yu Hsieh, Zhenxing Wu, Yu Kang, Jike Wang, Ercheng Wang, Ben Liao, Chao Shen, Lei Xu, Jian Wu, et al. Interactiongraphnet: A novel and efficient deep graph representation learning framework for accurate protein–ligand interaction predictions. Journal of medicinal chemistry, 64(24):18209–18232, 2021.
Pablo Gainza, Freyr Sverrisson, Frederico Monti, Emanuele Rodola, D Boscaini, MM Bronstein, and BE Correia. Deciphering interaction fingerprints from protein molecular surfaces using geometric deep learning. Nature Methods, 17(2):184–192, 2020.
John M Jumper, Nabil F Faruk, Karl F Freed, and Tobin R Sosnick. Accurate calculation of side chain packing and free energy with applications to protein molecular dynamics. PLoS computational biology, 14(12):e1006342, 2018.
Radoslav Krivák and David Hoksza. P2rank: machine learning based tool for rapid and accurate prediction of ligand binding sites from protein structure. Journal of cheminformatics, 10(1):1–12, 2018.
Zhaocheng Zhu, Chence Shi, Zuobai Zhang, Shengchao Liu, Minghao Xu, Xinyu Yuan, Yangtian Zhang, Junkun Chen, Huiyu Cai, Jiarui Lu, et al. Torchdrug: A powerful and flexible machine learning platform for drug discovery. arXiv preprint arXiv:2202.08320, 2022.
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
Raphael JL Townshend, Martin Vögele, Patricia Suriana, Alexander Derry, Alexander Powers, Yianni Laloudakis, Sidhika Balachandar, Bowen Jing, Brandon Anderson, Stephan Eismann, et al. Atom3d: Tasks on molecules in three dimensions. arXiv preprint arXiv:2012.04035, 2020.
Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 2, pages 1735–1742. IEEE, 2006.
Matthew Masters, Amr H Mahmoud, Yao Wei, and Markus Lill. Deep learning model for flexible and efficient protein-ligand docking. In ICLR2022 Machine Learning for Drug Discovery, 2022.
Moritz Hoffmann and Frank Noé. Generating valid euclidean distance matrices. arXiv preprint arXiv:1910.03131, 2019.
Zsolt Zsoldos, Darryl Reid, Aniko Simon, Sayyed Bashir Sadjad, and A Peter Johnson. ehits: a new fast, exhaustive flexible ligand docking system. Journal of Molecular Graphics and Modelling, 26 (1):198–212, 2007.
Stephen K Burley, Charmi Bhikadiya, Chunxiao Bi, Sebastian Bittrich, Li Chen, Gregg V Crichlow, Cole H Christie, Kenneth Dalenberg, Luigi Di Costanzo, Jose M Duarte, et al. Rcsb protein data bank: powerful new tools for exploring 3d structures of biological macromolecules for basic and applied research and education in fundamental biology, biomedicine, biotechnology, bioengineering and energy sciences. Nucleic acids research, 49(D1):D437–D451, 2021.
Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling, 2013.
Andrew T McNutt, Paul Francoeur, Rishal Aggarwal, Tomohide Masuda, Rocco Meli, Matthew Ragoza, Jocelyn Sunseri, and David Ryan Koes. Gnina 1.0: molecular docking with deep learning. Journal of cheminformatics, 13(1):1–20, 2021.
David Ryan Koes, Matthew P Baumgartner, and Carlos J Camacho. Lessons learned in empirical scoring with smina from the csar 2011 benchmarking exercise. Journal of chemical information and modeling, 53(8):1893–1904, 2013.
Lifan Chen, Xiaoqin Tan, Dingyan Wang, Feisheng Zhong, Xiaohong Liu, Tianbiao Yang, Xiaomin Luo, Kaixian Chen, Hualiang Jiang, and Mingyue Zheng. Transformercpi: improving compound– protein interaction prediction by sequence-based deep learning with self-attention mechanism and label reversal experiments. Bioinformatics, 36(16):4406–4414, 2020b.
Seokhyun Moon, Wonho Zhung, Soojung Yang, Jaechang Lim, and Woo Youn Kim. Pignet: a physics-informed deep learning model toward generalized drug–target interaction predictions. Chemical Science, 13(13):3661–3673, 2022.
Penglei Wang, Shuangjia Zheng, Yize Jiang, Chengtao Li, Junhong Liu, Chang Wen, Atanas Patronov, Dahong Qian, Hongming Chen, and Yuedong Yang. Structure-aware multimodal deep learning for drug–protein interaction prediction. Journal of Chemical Information and Modeling, 62(5): 1308–1317, 2022.
Roshan Rao, Nicholas Bhattacharya, Neil Thomas, Yan Duan, Peter Chen, John Canny, Pieter Abbeel, and Yun Song. Evaluating protein transfer learning with tape. Advances in neural information processing systems, 32, 2019.
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
Timo Lassmann. Kalign 3: multiple sequence alignment of large datasets, 2020.
Peter JA Cock, Tiago Antao, Jeffrey T Chang, Brad A Chapman, Cymon J Cox, Andrew Dalke, Iddo Friedberg, Thomas Hamelryck, Frank Kauff, Bartek Wilczynski, et al. Biopython: freely available python tools for computational molecular biology and bioinformatics. Bioinformatics, 25(11): 1422–1423, 2009.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315# Attracting and Dispersing: A Simple Approach for Source-free Domain Adaptation
Shiqi Yang1, Yaxing Wang2∗, Kai Wang1, Shangling $\mathbf { J u \mathbf { i } ^ { 3 } }$ , Joost van de Weijer1
1 Computer Vision Center, Universitat Autonoma de Barcelona, Barcelona, Spain 2 Nankai University, Tianjin, China 3 Huawei Kirin Solution, Shanghai, China {syang,kwang,joost}@cvc.uab.es, yaxing@nankai.edu.cn, jui.shangling@huawei.com
# Abstract
We propose a simple but effective source-free domain adaptation (SFDA) method. Treating SFDA as an unsupervised clustering problem and following the intuition that local neighbors in feature space should have more similar predictions than other features, we propose to optimize an objective of prediction consistency. This objective encourages local neighborhood features in feature space to have similar predictions while features farther away in feature space have dissimilar predictions, leading to efficient feature clustering and cluster assignment simultaneously. For efficient training, we seek to optimize an upper-bound of the objective resulting in two simple terms. Furthermore, we relate popular existing methods in domain adaptation, source-free domain adaptation and contrastive learning via the perspective of discriminability and diversity. The experimental results prove the superiority of our method, and our method can be adopted as a simple but strong baseline for future research in SFDA. Our method can be also adapted to source-free open-set and partial-set DA which further shows the generalization ability of our method. Code is available in https://github.com/Albert0147/AaD_SFDA.
# 1 Introduction
Supervised learning methods which are based on training with huge amounts of labeled data are advancing almost all fields of computer vision. However, the learned models typically perform decently on test data which have a similar distribution with the training set. Significant performance degradation will occur if directly applying those models to a new domain different from the training set, where the data distribution (such as variation of background, styles or camera parameter) is considerably different. This kind of distribution shift is formally denoted as domain/distribution shift. It limits the generalization of the model to unseen domains which is important in real-world applications. There are several research fields trying to tackle this problem. One of them is Domain Adaptation (DA), which aims to reduce the domain shift between the labeled source domain and unlabeled target domain. Typical works [12, 38] resort to learn domain-invariant features, thus improving generalization ability of the model between different domains. And in the past few years, the main research line of domain adaptation is either trying to minimize the distribution discrepancy between two domains [32, 33, 35], or deploying adversarial training on features to learn domain invariant representation [52, 68, 4, 36]. Some methods also tackle domain shift from the view of semi-supervised learning [67, 27] or clustering [7, 50, 5].
Many recent methods [24, 29, 64, 66, 55, 15, 61] focus on source-free domain adaptation (SFDA), where source data are unavailable during target adaptation, due to data privacy and intellectual property concerns of both users and businesses. Some SFDA methods resort to neighborhood clustering and pseudo labeling. However, pseudo labeling methods [29] may suffer from negative impact from noisy labels [28], and neighborhood clustering methods [66, 64] fail to investigate the potential information from dissimilar samples. Other methods either demand complex extra modules/processing [24, 61] or the storing of historical models for contrastive learning [15].
Table 1: Detailed comparison of SFDA methods on VisDA. ’ODA/PDA’ means whether the method reports the results for open-set or partial-set DA. $| { \mathcal { L } } |$ means number of training objective terms.
<table><tr><td>Method</td><td>Extra Modules/Processing</td><td>ODA/PDA</td><td>[C|</td><td>Per-class</td></tr><tr><td>SHOT[26] 3C-GAN [24]</td><td>Access all target data for pseudo labeling</td><td>×</td><td>3</td><td>82.9</td></tr><tr><td>A²Net [61]</td><td>Data generation by conditional GAN</td><td></td><td>5 5</td><td>81.6 84.3</td></tr><tr><td>G-SFDA [66]</td><td>Self-supervised learning with extra classifiers</td><td>X</td><td></td><td></td></tr><tr><td>NRC[64]</td><td>Store features for nearest neighbor retrieval</td><td>X</td><td>2</td><td>85.4</td></tr><tr><td>HCL [15]</td><td>Store features for 2-hop nearest neighbor retrieval Store historical models</td><td>X √</td><td>4 2</td><td>85.9 83.5</td></tr><tr><td>Ours</td><td></td><td>√</td><td>2</td><td>88.0</td></tr><tr><td></td><td>Store features for nearest neighbor retrieval</td><td></td><td></td><td></td></tr></table>
Based on the fact that target features from the source model already form some semantic structure and following the intuition that for a target feature from a (source-pretrained) model, similar features should have closer predictions than dissimilar ones, we propose a new objective dubbed as Attractingand-Dispersing (AaD) to achieve it. we upperbound this objective, resulting in a simple final objective which only contains two types of terms, which encourage discriminability and diversity respectively. Further, we unify several popular domain adaptation, source-free domain adaptation and contrastive learning methods from the perspective of discriminability and diversity. Experimental results on several benchmarks prove the superiority of our proposed method. Our simple method improves the state-of-the-art on the challenging VisDA with $2 . 1 \%$ to $8 8 . 0 \%$ . Additionally, extra experiments on open-set and partial-set DA further prove the effectiveness of our method. A preliminary comparison between different SFDA method is shown in Tab. 1, which shows the simplicity and generalization ability of our method: it only requires the storing of features and a few nearest neighbors searches without any additional module like a generator [24] or a classifier [61].
We summary our contributions as follows:
• We propose to tackle source-free domain adaptation by optimizing an upperbound of the proposed clustering objective, which is surprisingly simple. • We relate several popular existing methods in domain adaptation, source-free domain adaptation and contrastive learning via the perspective of discriminability and diversity, which is helpful to understand existing methods and beneficial for future improvement. • The experimental results prove the efficacy of our method, especially we achieve new state-of-theart on the challenging VisDA, and the method can be also extended to source-free open-set and partial-set domain adaptation.
# 2 Related Work
Domain Adaptation. Early DA methods such as [33, 49, 53] adopt moment matching to align feature distributions. For adversarial learning methods, DANN [9] formulates domain adaptation as an adversarial two-player game. The adversarial training of CDAN [34] is conditioned on several sources of information. DIRT-T [47] performs domain adversarial training with an added term that penalizes violations of the cluster assumption. Additionally, [22, 36, 44] adopts prediction diversity between multiple learnable classifiers to achieve local or category-level feature alignment between source and target domains. SRDC [50] proposes to directly uncover the intrinsic target discrimination via discriminative clustering to achieve adaptation. CST [31] proposes a simple self-training strategy to improve the rough pseudo label under domain shift.
Source-free Domain Adaptation. The above-mentioned normal domain adaptation methods need to access source domain data at all time during adaptation. In recent years plenty of methods emerge trying to tackle source-free domain adaptation. USFDA [20] and FS [21] resort to synthesize extra training samples in order to get compact decision boundaries, which is beneficial for both
# Algorithm 1 Attracting and Dispersing for SFDA
<table><tr><td colspan="2">Require: Source-pretrained model and target data Dt</td></tr><tr><td colspan="2">1:Build memory bank storing all target features and predictions</td></tr><tr><td>2: while Adaptation do</td><td></td></tr><tr><td>3:</td><td>Sample batch T from Dt and Update memory bank</td></tr><tr><td>4:</td><td>For each feature zi in T,retrieve K-nearest neighbors (Ci)and their predictions from memory bank</td></tr><tr><td>5:</td><td>Update model by minimizing Eq. 5</td></tr><tr><td colspan="2">6: end while</td></tr></table>
the detection of open classes and also target adaptation. SHOT [26] proposes to freeze the source classifier and it clusters target features by maximizing mutual information along with pseudo labeling for extra supervision. 3C-GAN [24] synthesizes labeled target-style training images. It is based on a conditional GAN to provide supervision for adaptation. BAIT [65] extends MCD [44] to source-free setting. $A ^ { 2 } \mathrm { { N e t } }$ [61] proposes to learn an additional target-specific classifier for hard samples and adopts a contrastive category-wise matching module to cluster target features. HCL [15] adopts Instance Discrimination [60] for features from current and historical models to cluster features, along with a generated pseudo label conditioned on historical consistency. G-SFDA [66] and NRC [64] propose neighborhood clustering which enforces prediction consistency between local neighbors.
Deep Clustering and Contrastive Learning. Recent Deep Clustering methods can be roughly divided into two groups, they the differ in how they learn the feature representation and cluster assignments, either simultaneously or alternatively. For example, DAC [2] and DCCM [58] alternately update cluster assignments and between-sample similarity. Simultaneous clustering methods IIC [18] and ISMAT [14] are based on mutual information maximizing between samples and theirs augmentations. LA [70] depends on a huge amount of nearest neighbor searches and multiple extra runs of $k$ -means clustering to aggregate features. Recent unsupervised clustering works [25, 51, 46] start to rely on contrastive learning, where InfoNCE [37] is typically deployed. And recently NNCLR [8] proposes to use nearest neighbors in the latent space as positives in contrastive learning to cover more semantic variations than pre-defined transformations. However an inevitable problem of normal contrastive learning is class collision where negative samples are from the same class. To tackle this issue, recent works [23, 16] propose to estimate cluster prototypes and integrate them into contrastive learning.
# 3 Method
For source-free domain adaptation (SFDA), we are given source-pretrained model in the beginning and an unlabeled target domain with $N _ { t }$ samples as $\mathcal { D } _ { t } = \{ x _ { i } ^ { t } \} _ { i = 1 } ^ { \bar { N } _ { t } }$ . Target domain have same $C$ classes as source domain in this paper (known as the closed-set setting). The goal of SFDA is to adapt the model to target domain without source data. We divide the model into two parts: the feature extractor $f$ , and the classifier $g$ . The output of the feature extractor is denoted as feature $( z _ { i } = f \left( x \right) \in \mathbb { R } ^ { \bar { h } } )$ , where $h$ is dimension of the feature space. The output of classifier is denoted as $( p _ { i } = \delta ( g ( z _ { i } ) ) \in \mathbb { R } ^ { C }$ ) where $\delta$ is the softmax function. We denote $\boldsymbol { P } \in \mathbb { R } ^ { b s \times C }$ as the prediction matrix in a mini-batch. Regarding the SFDA as an unsupervised clustering problem, we address SFDA problem by clustering target features based on the proposed AaD. In additionally, we relate our method with several existing DA, SFDA and contrastive learning methods.
# 3.1 Attracting and Dispersing for Source-free Domain Adaptation
Since the source-pretrained model already learns a good feature representation, it can provides a decent initialization for target adaptation. We propose to achieve SFDA by attracting predictions for features that are located close in feature space, while dispersing predictions of those features farther away in feature space.
We define $p _ { i j }$ as the probability that the feature $z _ { i } \in \mathbb { R } ^ { h }$ has similar (or the same) prediction to feature $\begin{array} { r } { z _ { j } \colon p _ { i j } = \frac { e ^ { p _ { i } ^ { T } p _ { j } } } { \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { t } p _ { k } } } } \end{array}$ It can be interpreted as the possibility that $p _ { j }$ is selected as the neighbor of $p _ { i }$ in the output space [10].
We then define two sets for each feature $z _ { i }$ : close neighbor set $\mathcal { C } _ { i }$ containing $K$ -nearest neighbors of $z _ { i }$ (with distances as cosine similarity), and background set $B _ { i }$ which contains the features that are not in $\mathcal { C } _ { i }$ (features potentially from different classes). To retrieve nearest neighbors for training, we build two memory banks to store all target features along with their predictions just like former works [27, 66, 64, 42], which is efficient in both memory and computation, since only the features along with their predictions computed in each mini-batch are used to update the memory bank.
Intuitively, for each feature $z _ { i }$ , the features in $B _ { i }$ should have less similar predictions than those in $ { { \mathcal { C } } } _ { i } { } ^ { 2 }$ . To achieve this, we first define two likelihood functions:
$$P ( \mathcal C _ { i } | \boldsymbol \theta ) = \prod _ { j \in \mathcal C _ { i } } p _ { i j } = \prod _ { j \in \mathcal C _ { i } } \frac { e ^ { p _ { i } ^ { T } p _ { j } } } { \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { T } p _ { k } } } , P ( \mathcal B _ { i } | \boldsymbol \theta ) = \prod _ { j \in \mathcal B _ { i } } p _ { i j } = \prod _ { j \in \mathcal B _ { i } } \frac { e ^ { p _ { i } ^ { T } p _ { j } } } { \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { T } p _ { k } } }$$
where $\theta$ denotes parameters of the model, for readability we omit $\theta$ in following equations. The probability $p _ { j }$ in Eq. 1 is the stored prediction for neighborhood feature $z _ { j }$ , which is retrieved from the memory bank.
We then propose to achieve target features clustering by minimizing the following negative loglikelihood, denoted as $A a D$ (Attracting-and-Dispersing):
$$\tilde { L } _ { i } ( \mathcal { C } _ { i } , \mathcal { B } _ { i } ) = - \log \frac { P ( \mathcal { C } _ { i } ) } { P ( \mathcal { B } _ { i } ) }$$
Noting that, if we only have $P ( \mathcal { C } _ { i } )$ , it will be similar to Instance Discrimination [60], but we also consider $P ( B _ { i } )$ and we operate on predictions instead of features. If regarding weights of the classifier $g$ as classes prototypes, optimizing Eq. 2 is not only pulling features towards their closest neighbors and pushing them away from background features, but also towards (or away from) corresponding class prototypes. Therefore, we can achieve feature clustering and cluster assignment simultaneously.
To simplify the training, instead of manually and carefully sampling background features, we use all other features except $z _ { i }$ in the mini-batch as $B _ { i }$ , which can be regarded as an estimation of the distribution of the whole dataset. We can reasonably believe that overall similarity of features in $\mathcal { C } _ { i }$ is potentially higher than that of $B _ { i }$ , even if $B _ { i }$ has intersection with $\mathcal { C } _ { i }$ since features in $\mathcal { C } _ { i }$ are the closest ones to feature $z _ { i }$ . By optimizing Eq. 2, we are encouraging features in $\mathcal { C } _ { i }$ , which have a higher chance of belonging to the same class, to have more similar predictions to $z _ { i }$ than those features in $B _ { i }$ , which have a lower chance of belonging to the same class. Note all features will show up in both the first and second term; intra-cluster alignment and inter-cluster separability are expected to be achieved after training.
One problem optimizing Eq. 2 is that all target data are needed to compute Eq. 1, which is infeasible in real-world situation. Here we resort to get an upper-bound of Eq. 2:
$$\begin{array} { l } { \tilde { L } _ { i } ( \mathcal { C } _ { i } , \mathcal { B } _ { i } ) = - \log \displaystyle \frac { P ( \mathcal { C } _ { i } ) } { P ( \mathcal { B } _ { i } ) } = - \sum _ { j \in \mathcal { C } _ { i } } [ p _ { i } ^ { T } p _ { j } - \log ( \displaystyle \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { T } p _ { k } } ) ] + \sum _ { m \in \mathcal { B } _ { i } } [ p _ { i } ^ { T } p _ { m } - \log ( \displaystyle \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { T } p _ { k } } ) ] } \\ { \displaystyle = - \sum _ { j \in \mathcal { C } _ { i } } p _ { i } ^ { T } p _ { j } + \sum _ { m \in \mathcal { B } _ { i } } p _ { i } ^ { T } p _ { m } + ( N _ { \mathcal { C } _ { i } } - N _ { \mathcal { B } _ { i } } ) \log ( \displaystyle \sum _ { k = 1 } ^ { N _ { t } } e ^ { p _ { i } ^ { T } p _ { k } } ) } \end{array}$$
Since we set $N _ { \mathcal { C } _ { i } } < N _ { B _ { i } }$ , with Jensen’s inequality:
$$\begin{array} { r l } & { \tilde { L } _ { i } ( \mathcal { C } _ { i } , \mathcal { B } _ { i } ) \leq - \displaystyle \sum _ { j \in \mathcal { C } _ { i } } p _ { i } ^ { T } p _ { j } + \displaystyle \sum _ { m \in \mathcal { B } _ { i } } p _ { i } ^ { T } p _ { m } + ( N _ { \mathcal { C } _ { i } } - N _ { \mathcal { B } _ { i } } ) ( \displaystyle \sum _ { k = 1 } ^ { N _ { t } } \frac { 1 } { N _ { t } } p _ { i } ^ { T } p _ { k } + \log N _ { t } ) } \\ & { \qquad \quad \simeq \displaystyle \sum _ { m \in \mathcal { B } _ { i } } p _ { i } ^ { T } p _ { m } - \displaystyle \sum _ { j \in \mathcal { C } _ { i } } p _ { i } ^ { T } p _ { j } + ( N _ { \mathcal { C } _ { i } } - N _ { \mathcal { B } _ { i } } ) ( \displaystyle \sum _ { k \in \mathcal { B } _ { i } } \frac { p _ { i } ^ { T } p _ { k } } { N _ { \mathcal { B } _ { i } } } + \log N _ { t } ) } \\ & { \qquad \quad = - \displaystyle \sum _ { j \in \mathcal { C } _ { i } } p _ { i } ^ { T } p _ { j } + \displaystyle \frac { N _ { \mathcal { C } _ { i } } } { N _ { \mathcal { B } _ { i } } } \displaystyle \sum _ { m \in \mathcal { B } _ { i } } p _ { i } ^ { T } p _ { m } + ( N _ { \mathcal { C } _ { i } } - N _ { \mathcal { B } _ { i } } ) \log N _ { t } } \end{array}$$
Table 2: Decomposition of methods into two terms: discriminability $( d i s )$ and diversity $( d i \nu )$ , which will be minimized for training.
<table><tr><td>Method</td><td>Task</td><td>disterm</td><td>div term</td></tr><tr><td>MI</td><td>SFDA&Clustering</td><td>H(Y|X)</td><td>-H(Y)</td></tr><tr><td>BNM</td><td>DA&SFDA</td><td>-|PIlF</td><td>-rank(P)</td></tr><tr><td>NC</td><td>SFDA</td><td>-g(WijpTpj)</td><td>∑KL(llge))</td></tr><tr><td>InfoNCE</td><td>Contrastive</td><td>-f(x)Tf(y)/T</td><td>log(+∑ef(x)f(x)/T)</td></tr><tr><td>Ours</td><td>SFDA</td><td>-∑jecppj</td><td>∑meB:pTPm</td></tr></table>
where $N _ { { \mathcal { C } } _ { i } }$ and $N _ { B _ { i } }$ is the number of features in $\mathcal { C } _ { i }$ and $B _ { i }$ . Note that we cannot get this upper-bound without $\dot { P ( B _ { i } ) }$ . The approximation above in the penultimate line is to estimate the average dot product using the mini-batch data. This leads to the surprisingly simple final objective for unsupervised domain adaptation:
$$L = \mathbb { E } [ L _ { i } ( \mathcal { C } _ { i } , \mathcal { B } _ { i } ) ] , \mathrm { w i t h ~ } L _ { i } ( \mathcal { C } _ { i } , \mathcal { B } _ { i } ) = - \sum _ { j \in \mathcal { C } _ { i } } p _ { i } ^ { T } p _ { j } + \lambda \sum _ { m \in \mathcal { B } _ { i } } p _ { i } ^ { T } p _ { m }$$
Note the gradient will come from both $p _ { i }$ and $p _ { m }$ . The first term aims to enforce prediction consistency between local neighbors, and the naive interpretation of second term is to disperse the prediction of potential dissimilar features, which are all other features in the mini-batch. Note that the dot product between two softmaxed predictions will be maximal when two predictions have the same predicted class and are close to one-hot vector. Our algorithm is illustrated in Algorithm. 1.
Unlike using a constant for the second term in Eq. 4 we empirically found that using a hyperparameter $\lambda$ to decay second term (starting from 1) works better, we will adopt SND [43] to tune this hyperparameter unsupervisedly. One reason may be that the approximation inside Eq. 3.1 is not necessarily accurate. And as training goes on, features are gradually clustering, the role of the second term for dispersing should be weakened. Additionally, considering the current mini-batch with the correctly predicted features $z _ { i }$ and $z _ { m }$ belonging to the same class. In this case the second term in both $L _ { i } ( \mathcal { C } _ { i } , B _ { i } )$ and $L _ { m } ( \mathcal { C } _ { m } , B _ { m } )$ tends to push $p _ { m }$ to the wrong direction, while the first term in $L _ { m } ( \mathcal { C } _ { m } , B _ { m } )$ can potentially keep current (correct) prediction unchanged. Hence, this will suppress the negative impact of the second term. We will further deepen the understanding of these two terms in the next subsection.
# 3.2 Relation to Existing Works
In this section, we will relate several popular DA, SFDA and contrastive learning methods through two objectives, discriminability and diversity. This can improve our understanding of domain adaptation methods, as well as improve the understanding of our method.
Mutual Information maximizing (MI). SHOT-IM [26] proposes to achieve source-free domain adaptation by maximizing the mutual information, which is actually widely used in unsupervised clustering [11, 40, 14]:
$${ \cal L } _ { M I } = H ( Y | X ) - H ( Y )$$
which contains two terms: conditional entropy term $H ( Y | X )$ to encourages unambiguous cluster assignments, and marginal entropy term $H ( Y )$ to encourage cluster sizes to be uniform to avoid degeneracy. In practice, $H ( Y )$ is approximated by the current mini-batch instead of using whole dataset [48, 14].
Batch Nuclear-norm Maximization (BNM). BNM [5, 6] aims to increase prediction discriminability and diversity to tackle domain shift. It is originally achieved by maximizing $F$ -norm (for discriminability) and rank of prediction matrix (for diversity) respectively:
$$L = - \| P \| _ { F } - r a n k ( P )$$
In their paper, they further prove merely maximizing the nuclear norm $\| P \| _ { * }$ can achieve these two goals simultaneously. In relation to our method, if target features are well clustering during training, we can presume the K-nearest neighbors of feature $z _ { i }$ have the same prediction, the first term in Eq. 5 can be seen as the summation of diagonal elements of matrix $P P ^ { T }$ , which is actually the square of $F$ -norm $( \| P \| _ { F } = { \sqrt { t r a c e ( P P ^ { T } ) } } )$ , then it is actually minimizing prediction entropy [5]. As for second term, we can regard it as the summation of non-diagonal element of $P P ^ { T }$ , it encourages all these non-diagonal elements to be 0 thus the $r a n k ( P P ^ { T } ) = r a n k ( P )$ is supposed to increase, which indicates larger prediction diversity [5]. In a nutshell, compared to SHOT and BNM our method first considers local feature structure to cluster target features, which can be treated as an alternative way to increase discriminability at the late training stage, meanwhile as discussed above our method is also encouraging diversity.
Neighborhood Clustering (NC). G-SFDA [66] and NRC [64] are based on neighborhood clustering to tackle SFDA problem. Those works basically contain two major terms in their optimizing objective: a neighborhood clustering term for prediction consistency and a marginal entropy term $H ( Y )$ for prediction diversity. NRC [64] further introduces neighborhood reciprocity to weight the different neighbors. Their loss objective can be written as:
$$L _ { i } = - \sum _ { j \in \mathcal { C } _ { i } } g ( W _ { i j } p _ { i } ^ { T } p _ { j } ) + \sum _ { c = 1 } ^ { C } \mathbf { K L } ( \bar { p } _ { c } | | q _ { c } ) , \mathrm { ~ w i t h ~ } \bar { p } _ { c } = \frac { 1 } { n _ { t } } \sum _ { i } p _ { i } ^ { ( c ) } , \mathrm { ~ a n d ~ } q _ { \{ c = 1 , . . . , C \} } = \frac { 1 } { C }$$
where $W _ { i j }$ will weight the importance of neighbor and $g ( \cdot )$ is log or identity function. Although the first term of G-SFDA and NRC is the same as that of our final loss objective Eq. 5, note that our motivation is different as we simultaneously consider similar and dissimilar features, and Eq. 5 is deduced as an approximated upper-bound of our original objective Eq. 2.
And note actually the marginal entropy termAlthough the second term of those metho $\begin{array} { r } { - H ( Y ) = \sum _ { c = 1 } ^ { C } \bar { p } _ { c } \log \bar { p } _ { c } = \sum _ { c = 1 } ^ { C } { \bf K } { \bf L } \left( \bar { p } _ { c } | | q _ { c } \right) - \log C . } \end{array}$ solution where all images are only assigned to some certain classes, the margin entropy term presumes the prior that whole dataset or the mini-batch is class balance/uniformly distributed, which is barely true for current benchmarks or in real-world environment. In conclusion, the above three types of methods are actually all to increase discriminability and meanwhile maximize diversity of the prediction, but through different ways.
Contrastive Learning. Here we also link our method to InfoNCE [37]), which is widely used in contrastive learning. As a recent paper [56] points out that InfoNCE loss can be decomposed into 2 terms:
$$\chi _ { i n f o N C E } = \mathbb { E } _ { ( x , y ) \sim p _ { p o s } } [ - f ( x ) ^ { T } f ( y ) / \tau ] \ + \underset { x \sim p _ { d a t a } } { \mathbb { E } } ~ \underset { \substack { i = 1 \sim { p _ { d a t a } } \ \{ x _ { i } ^ { - } \} _ { i = 1 } ^ { M } \sim p _ { d a t a } } } [ \log ( e ^ { 1 / \tau } + \sum _ { i } e ^ { f ( x _ { i } ^ { - } ) ^ { T } f ( x ) / \tau } ) ]$$
The first term is denoted as alignment term (with positive pairs) is to make positive pairs of features similar, and the second term denoted as uniformity term with negative pairs encouraging all features to roughly uniformly distributed in the feature space.
The Eq. 8 shares some similarity with all the above domain adaptation methods in that the first term is for the alignment with positive pairs and the second term is to encourage diversity. But note that the remarkable difference is that the above domain adaptation methods operate in the output (prediction) space while contrastive learning is conducted in the (spherical) feature space. Therefore, simultaneously feature representation learning and cluster assignment can be achieved for those domain adaptation methods. Note in normal contrastive learning methods, extra KNN or a linear learnable classifier needs to be deployed for final classification, while our model can directly give predictions.
We list all above methods in Tab. 2. Finally, returning to Eq. 5, we can also regard the second term as a variant of diversity loss to avoid degeneration solution, but without making any category prior assumption. Intuitively, with target features forming groups during training, the second term should play less and less important role, otherwise it may destabilize the training. This is similar to the class collision issue in contrastive learning. If our second term contains too many features belonging to the same class. Thus it is reasonable to decay the second term.
# 4 Experiments
Datasets. We conduct experiments on three benchmark datasets for image classification: Office-31, Office-Home and VisDA-C 2017. Office-31 [41] contains 3 domains (Amazon, Webcam, DSLR)
Table 3: Accuracies $( \% )$ on Office-Home for ResNet50-based methods. We highlight the best result and underline the second best one.
<table><tr><td>Method</td><td></td><td>SFAr→CIAr-→PrAr-→RwCl-→ArCl-→PrCl-→RwPr-→ArPr->CIPr-→RwRw→ArRw→CIRw→PrAvg</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ResNet-50[13]</td><td></td><td>X 34.9</td><td>50.0</td><td>58.0</td><td>37.4</td><td>41.9</td><td>46.2</td><td>38.5</td><td>31.2</td><td>60.4</td><td>53.9</td><td>41.2 59.9</td><td>46.1</td></tr><tr><td>MCD [44]</td><td></td><td>xxx 48.9</td><td>68.3</td><td>74.6</td><td>61.3</td><td>67.6</td><td>68.8</td><td>57.0</td><td>47.1</td><td>75.1</td><td>69.1</td><td>52.2 79.6</td><td>64.1</td></tr><tr><td>CDAN[34]</td><td></td><td>50.7</td><td>70.6</td><td>76.0</td><td>57.6</td><td>70.0</td><td>70.0</td><td>57.4</td><td>50.9</td><td>77.3 70.9</td><td>56.7</td><td>81.6</td><td>65.8</td></tr><tr><td>SAFN[63]</td><td></td><td>52.0</td><td>71.7</td><td>76.3</td><td>64.2</td><td>69.9</td><td>71.9</td><td>63.7</td><td>51.4</td><td>77.1 70.9</td><td>57.1</td><td>81.5</td><td>67.3</td></tr><tr><td>MDD [69]</td><td></td><td>X 54.9</td><td>73.7</td><td>77.8</td><td>60.0</td><td>71.4</td><td>71.8</td><td>61.2</td><td>53.6</td><td>78.1 72.5</td><td>60.2</td><td>82.3</td><td>68.1</td></tr><tr><td>TADA [57]</td><td></td><td>×x 53.1</td><td>72.3</td><td>77.2</td><td>59.1</td><td>71.2</td><td>72.1</td><td>59.7</td><td>53.1</td><td>78.4</td><td>72.4</td><td>60.0 82.9</td><td>67.6</td></tr><tr><td>SRDC [50]</td><td></td><td>52.3</td><td>76.3</td><td>81.0</td><td>69.5</td><td>76.2</td><td>78.0</td><td>68.7</td><td>53.8</td><td>81.7</td><td>76.3</td><td>57.1 85.0</td><td>71.3</td></tr><tr><td>SHOT[26]</td><td></td><td>√ 57.1</td><td>78.1</td><td>81.5</td><td>68.0</td><td>78.2</td><td>78.1</td><td>67.4</td><td>54.9</td><td>82.2</td><td>73.3 58.8</td><td>84.3</td><td>71.8</td></tr><tr><td>A²Net [61]</td><td></td><td>58.4</td><td>79.0</td><td>82.4</td><td>67.5</td><td>79.3</td><td>78.9</td><td>68.0</td><td>56.2</td><td>82.9 74.1</td><td>60.5</td><td>85.0</td><td>72.8</td></tr><tr><td>G-SFDA [66]</td><td></td><td>√ 57.9</td><td>78.6</td><td>81.0</td><td>66.7</td><td>77.2</td><td>77.2</td><td>65.6</td><td>56.0</td><td>82.2</td><td>72.0</td><td>57.8 83.4</td><td>71.3</td></tr><tr><td>NRC [64]</td><td></td><td>√ 57.7</td><td>80.3</td><td>82.0</td><td>68.1</td><td>79.8</td><td>78.6</td><td>65.3</td><td>56.4</td><td>83.0</td><td>71.0</td><td>58.6 85.6</td><td>72.2</td></tr><tr><td>BNM-S [6]</td><td></td><td>√ 57.4</td><td>77.8</td><td>81.7</td><td>67.8</td><td>77.6</td><td>79.3</td><td>67.6</td><td>55.7</td><td>82.2</td><td>73.5</td><td>59.5 84.7</td><td>72.1</td></tr><tr><td>Ours</td><td></td><td>59.3</td><td>79.3</td><td>82.1</td><td>68.9</td><td>79.8</td><td>79.5</td><td>67.2</td><td>57.4</td><td>83.1</td><td>72.1</td><td>58.5 85.4</td><td>72.7</td></tr></table>
Table 4: Accuracies $( \% )$ on VisDA-C (Synthesis $ \mathrm { R e a l }$ ) for ResNet101-based methods. We highlight the best result and underline the second best one.
<table><tr><td>Method</td><td>[SF</td><td>plane</td><td>bcycl bus</td><td>car</td><td>horse</td><td>knifemcycl</td><td></td><td>person</td><td></td><td></td><td></td><td>plant sktbrd train truck Per-class</td></tr><tr><td>ResNet-101[13]</td><td></td><td>55.1</td><td>53.3 61.9</td><td>59.1</td><td>80.6</td><td>17.9</td><td>79.7 31.2</td><td>81.0</td><td>26.5</td><td>73.5</td><td>8.5</td><td>52.4</td></tr><tr><td>CDAN+BSP[3]</td><td></td><td>92.4</td><td>61.0</td><td>81.0 57.5</td><td>89.0</td><td>80.6</td><td>90.1</td><td>77.0 84.2</td><td>77.9</td><td>82.1</td><td>38.4</td><td>75.9</td></tr><tr><td>MCC[19]</td><td></td><td>88.7</td><td>80.3</td><td>80.5 71.5</td><td>90.1</td><td>93.2</td><td>85.0</td><td>71.6 89.4</td><td>73.8</td><td>85.0</td><td>36.9</td><td>78.8</td></tr><tr><td>STAR[36]</td><td></td><td>95.0</td><td>84.0</td><td>84.6 73.0</td><td>91.6</td><td>91.8</td><td>85.9 78.4</td><td>94.4</td><td>84.7</td><td>87.0</td><td>42.2</td><td>82.7</td></tr><tr><td>RWOT[62]</td><td>xxxxx</td><td>95.1 80.3</td><td>83.7</td><td>90.0</td><td>92.4</td><td>68.0</td><td>92.5 82.2</td><td>87.9</td><td>78.4</td><td>90.4</td><td>68.2</td><td>84.0</td></tr><tr><td>3C-GAN [24]</td><td></td><td>94.8 73.4</td><td>68.8</td><td>74.8</td><td>93.1</td><td>95.4</td><td>88.6 84.7</td><td>89.1</td><td>84.7</td><td>83.5</td><td>48.1</td><td>81.6</td></tr><tr><td>SHOT[26]</td><td>v√</td><td>94.3 88.5</td><td></td><td>80.1 57.3</td><td>93.1</td><td>94.9</td><td>80.7</td><td>80.3 91.5</td><td>89.1</td><td>86.3</td><td>58.2</td><td>82.9</td></tr><tr><td>A²Net [61]</td><td></td><td>94.0 87.8</td><td>85.6</td><td>66.8</td><td>93.7</td><td>95.1</td><td>85.8</td><td>81.2 91.6</td><td>88.2</td><td>86.5</td><td>56.0</td><td>84.3</td></tr><tr><td>G-SFDA [66]</td><td></td><td>96.1 88.3</td><td>85.5</td><td>74.1</td><td>97.1</td><td>95.4</td><td>89.5</td><td>79.4 95.4</td><td>92.9</td><td>89.1</td><td>42.6</td><td>85.4</td></tr><tr><td>NRC [64]</td><td></td><td>96.8 91.3</td><td>82.4</td><td>62.4</td><td>96.2</td><td>95.9</td><td>86.1</td><td>80.6 94.8</td><td>94.1</td><td>90.4</td><td>59.7</td><td>85.9</td></tr><tr><td>HCL [15]</td><td>vvv√</td><td>93.3</td><td>85.4</td><td>80.7 68.5</td><td>91.0</td><td>88.1</td><td>86.0</td><td>78.6 86.6</td><td>88.8</td><td>80.0</td><td>74.7</td><td>83.5</td></tr><tr><td>Ours</td><td>√</td><td>97.4</td><td>90.5</td><td>80.8 76.2</td><td>97.3</td><td>96.1</td><td>89.8</td><td>82.9 95.5</td><td>93.0</td><td>92.0</td><td>64.7</td><td>88.0</td></tr></table>
with 31 classes and 4,652 images. Office-Home [54] contains 4 domains (Real, Clipart, Art, Product) with 65 classes and a total of 15,500 images. VisDA (VisDA-C 2017) [39] is a more challenging dataset, with 12-class synthetic-to-real object recognition tasks, its source domain contains of 152k synthetic images while the target domain has $5 5 \mathrm { k }$ real object images.
Evaluation. The column SF in the tables denotes source-free. For Office-31 and Office-Home, we show the results of each task and the average accuracy over all tasks ${ \it A } \nu g$ in the tables). For VisDA, we show accuracy for all classes and average over those classes (Per-class in the table). All results are the average of three random runs for target adaptation.
Model details. To ensure fair comparison with related methods, we adopt the backbone of a ResNet-50 [13] for Office-Home and ResNet-101 for VisDA. Specifically, we use the same network architecture as SHOT [26], BNM-S [6], G-SFDA [66] and NRC [64], i.e., the final part of the network is: fully connected layer - Batch Normalization $I I 7 J$ - fully connected layer with weight normalization $I 4 5 J$ . We adopt SGD with momentum 0.9 and batch size of 64 for all datasets. The learning rate for Office-31 and Office-Home is set to 1e-3 for all layers, except for the last two newly added fc layers, where we apply 1e-2. Learning rates are set 10 times smaller for VisDA. We train 40 epochs for Office-31 and Office-Home while 15 epochs for VisDA.
There are two hyperparameters $N _ { { \mathcal { C } } _ { i } }$ (number of nearest neighbors) and $\lambda$ , to ensure fair comparison we set $N _ { { \mathcal { C } } _ { i } }$ to the same number as previous works G-SFDA [66] and NRC [64], which also resort to nearest neighbors. That is, we set $N _ { { \mathcal { C } } _ { i } }$ to 3 on Office-31 and Office-Home, 5 on VisDA. For $\lambda$ , we set it as $\begin{array} { r } { \lambda = ( 1 + 1 0 * \frac { i t e r } { m a x \_ i t e r } ) ^ { - \beta } } \end{array}$ , where the decay factor $\beta$ controls the decaying speed. We directly apply SND $I 4 3 J$ to select $\beta$ unsupervisedly. Based on SND we set $\beta$ to 0 on Office-Home, 2 on Office-31 and 5 on VisDA.
# 4.1 Results and Analysis
Quantitative Results. As shown in Tables $3 { - } 5 ( L e f t )$ , where the top part shows results for the source-present methods that use source data during adaptation, and the bottom part shows results for the source-free DA methods. On Office-31 and VisDA, our method gets state-of-the-art performance compared to existing source-free domain adaptation methods, especially on VisDA our method outperforms others by a large margin $2 . 1 \%$ compared to NRC). And our method achieves similar results on Office-Home compared to the more complex $A ^ { \mathrm { 2 } } \mathrm { N e t }$ method (which combines three classifiers and five objective functions). The reported results clearly demonstrate the efficiency of the proposed method for source-free domain adaptation. It also achieves similar or better results compared to domain adaptation methods with access to source data on both Office-Home and VisDA. Note the extension of SHOT called $\mathrm { S H O T + + }$ [30] deploys extra self-supervised training and semisupervised learning, which are general to improve the results (an evidence is that the source model after these 2 tricks gets huge improvement, e.g., $6 0 . 2 \%$ improves to $6 6 . 6 \%$ on Office-Home.), we do not list it here for fair comparison.
Table 5: (Left) Accuracies $( \% )$ on Office-31 for ResNet50-based methods. We highlight the best result and underline the second best one. (Right) Ablation study on number of nearest neighbors $N _ { { \mathcal { C } } _ { i } }$ . We highlight the best score and underline the second best one.
<table><tr><td>Method</td><td></td><td colspan="3">JSFA→DA→WD-→WW-→DD-→AW→AAvg</td></tr><tr><td>MCD [44] CDAN [34] MDD[69]] DMRL[59] MCC[19]</td><td>X .xxxxx</td><td>92.2 88.6 92.9 94.1 90.4 90.4 93.4 90.8 95.6 95.4</td><td>98.5 98.6 100.0 98.7 99.9 99.0 100.0 98.6 100.0</td><td>100.0 69.5 69.7 86.5 71.0 75.0 73.0 71.2 72.6</td><td>69.3 87.7 73.7 88.0 87.9</td></tr><tr><td>SRDC [50] SHOT[26] 3C-GAN [24] NRC[64] HCL [15] BNM-S [6]</td><td></td><td>95.8 95.7 94.0 90.1 92.7 93.7 96.0 90.8 94.7 92.5 93.0 92.9</td><td>99.2 98.4 98.5 99.0 98.2 98.2</td><td>100.0 76.7 77.1 99.9 74.7 74.3 99.8 75.3 77.8 100.0 75.3 75.0 100.0 75.9 77.7 99.9 75.4 75.0</td><td>73.9 89.4 90.8 88.6 89.6 89.4 89.8 89.1</td></tr></table>
<table><tr><td>Nc</td><td>Avg</td><td colspan="2"></td></tr><tr><td>Office-31</td><td></td><td>Nc</td><td>Per-class</td></tr><tr><td>1</td><td>89.1</td><td>VisDA</td><td></td></tr><tr><td>2</td><td>89.5</td><td>3</td><td>86.7</td></tr><tr><td>3</td><td>89.9</td><td>4</td><td>87.4</td></tr><tr><td>Office-Home</td><td></td><td>5</td><td>88.0</td></tr><tr><td>1</td><td>72.2</td><td>6</td><td>88.0</td></tr><tr><td>2</td><td>72.6</td><td>7</td><td>88.0</td></tr><tr><td>3</td><td>72.7</td><td></td><td></td></tr></table>
 Figure 1: Visualization of decision boundary on target data with different training objective.
Toy dataset. We carry out an experiment on the twinning moona dataset to ablate the influence of two terms in our objective Eq. 5. For the twinning moons dataset, the data from the source domain are represented by two inter-twinning moons, which contain 300 samples each. Data in the target domain are generated through rotating source data by $3 0 ^ { \circ }$ . The domain shift here is instantiated as the rotation degree. First we train the model with 3 linear layers only on the source domain, and test the model on all domains. As shown in the first image in Fig. 1, the source model performs badly on target data. Then we conduct several variants of our method to train the model. The visualization of the decision boundary in Fig. 1 indicates that both terms in Eq. 5 are necessary, and decay of second term is shown to be important.
Table 6: Unsupervised hyperparameter selection of $\beta$ with SND [43], larger SND should correspond to better target model.
<table><tr><td colspan="2">VisDA</td></tr><tr><td>β</td><td>SND个 Per-class</td></tr><tr><td>0 1</td><td>8.1823 77.5 8.2584 83.8</td></tr><tr><td>2 8.3214</td><td>86.7</td></tr><tr><td>3 8.3311</td><td>87.6</td></tr><tr><td>4</td><td>8.3540 88.0</td></tr><tr><td>5 8.3543</td><td>88.0</td></tr><tr><td>7 8.3530</td><td>88.1</td></tr></table>
<table><tr><td colspan="2">Office-31</td></tr><tr><td>β</td><td>SND↑ Avg</td></tr><tr><td>0</td><td>4.1366 88.0</td></tr><tr><td>0.25 4.3016</td><td>89.7</td></tr><tr><td>1 4.4494</td><td>89.9</td></tr><tr><td>2 4.4501</td><td>89.9</td></tr></table>
<table><tr><td colspan="2">Office-Home</td></tr><tr><td>β</td><td>SND个 Avg</td></tr><tr><td>0</td><td>3.7515 72.7</td></tr><tr><td>0.25</td><td>3.7402 72.6</td></tr><tr><td>0.5 3.7252</td><td>72.0</td></tr><tr><td>1 3.6923</td><td>70.6</td></tr></table>
 Figure 2: (Left) Ratio of features which have 3 nearest neighbor features sharing the same predicted label. (Right) Ratio among above features which have 3 nearest neighbor features sharing the same and correct predicted label.
Table 7: Runtime analysis on SHOT and our method. For SHOT, pseudo labels are computed at each epoch. $10 \%$ and $5 \%$ denote the percentage of target features which are stored in the memory bank.
<table><tr><td>VisDA</td><td>Runtime (s/epoch)Per-class (%)</td><td></td></tr><tr><td>SHOT</td><td>618.82</td><td>82.9</td></tr><tr><td>Ours</td><td>520.13</td><td>88.0</td></tr><tr><td>Ours(10% for memory bank)</td><td>490.21</td><td>87.6</td></tr><tr><td>Ours(5% for memory bank)</td><td>482.77</td><td>87.5</td></tr></table>
Number of nearest neighbors $( N _ { C _ { i } } )$ . For the number of nearest neighbors used for the first term in Eq. 5, we show in Tab. 5 $( R i g h t )$ our method is robust to the choice of $N _ { { \mathcal { C } } _ { i } }$ , as the results imply that a reasonable choice of $N _ { { \mathcal { C } } _ { i } }$ (such as 3) works quite well on all datasets, since only considering few neighbors (such as $1 / 2$ ) may be too noisy if all of them are misclassified, while setting $N _ { { \mathcal { C } } _ { i } }$ too larger may also potentially include samples of other categories. For larger dataset such as VisDA we can choose a relatively larger $N _ { { \mathcal { C } } _ { i } }$ . Note the reason why we choose $N _ { { \mathcal { C } } _ { i } }$ as 5 in main experiments is to compare fairly with G-SFDA [66] and NRC [64].
Decay factor $\beta$ . According to the analysis in Sec. 3.2, the second term acts like a diversity term to avoid that all target features collapse to a limited set of categories. The role of the second term should be weakened during the training, but how to decay the second term is non-trivial. We directly adopt SND [43] which computes Soft Neighborhood Density for unsupervised hyperparameter selection of $\beta$ . The method is unsupervised and larger SND predicts a better target models. The results of $S N D$ with different $\beta$ are shown in Tab. 6, the results prove that SND works well to choose optimal $\beta$ .
Runtime analysis. Instead of storing all features in the memory bank, we can only stores a limited number of target features, by updating the memory bank at the end of each iteration by taking the $n$ (batch size) embeddings from the current training iteration and concatenating them at the end of the memory bank, and discard the oldest $n$ elements from the memory bank. We report the results with this type of memory bank of different buffer size in the Table 7. The results show that indeed this could be an efficient way to reduce computation on very large datasets.
Degree of clustering during training. We also plot how features are clustered with different decaying factors $\beta$ on VisDA in Fig. 2. The left one shows the ratio of features which have 3-nearest neighbors all sharing the same prediction, which indicates the degree of clustering during training, and the right one shows the ratio among above features which have 3-nearest neighbor features sharing the same and correct predicted label. Those curves in Fig. 2 left show that the target features are clustering, and those in Fig. 2 right indicate that clear category boundaries are emerging. The numbers in the legends denote the deployed $\beta$ and the corresponding final accuracy. From the figures we can draw the conclusion that with a larger decay factor $\beta$ on VisDA, features are quickly clustering and forming inter-class boundaries, since the ratio of features which share the same and correct prediction with neighbors are increasing faster. When decaying factor $\beta$ is too small, meaning training signal from the second term is strong, the clustering process is actually impeded. The curves in Fig. 2 (left) signify that this ratio can also be used to choose $\beta$ with higher performance unsupervisedly.
Table 8: Accuracy on Office-Home using ResNet-50 as backbone for Source-free open-set DA. $O S ^ { * }$ , UNK and $H O S$ mean average per-class accuracy across known classes, unknown accuracy and harmonic mean between known and unknown accuracy respectively.
<table><tr><td colspan="3">Ar→Cl</td><td colspan="2">Ar→Pr</td><td colspan="2"></td><td colspan="2">Ar→Rw</td><td colspan="2">Cl→Ar</td><td colspan="2">Cl→Pr</td><td colspan="4">Cl→Rw</td></tr><tr><td></td><td colspan="2">OS*UNK HOS</td><td colspan="2">OS*UNK HOS</td><td colspan="2"></td><td colspan="2">OS*UNK HOS</td><td colspan="2">OS*UNK HOS</td><td colspan="2">OS*UNK HOS</td><td colspan="2">OS*UNK HOS</td><td colspan="2"></td></tr><tr><td>SHOT 67.0 28.0 39.5</td><td></td><td></td><td></td><td>81.8 26.339.8</td><td></td><td></td><td>87.532.1 47.0</td><td></td><td>66.846.2 54.6</td><td></td><td>77.527.240.2</td><td></td><td>80.025.939.1</td><td colspan="2"></td></tr><tr><td>AaD 50.7 66.4 57.6</td><td></td><td></td><td></td><td>64.6 69.4 66.9</td><td></td><td></td><td>73.166.9 69.9</td><td></td><td>48.2 81.1 60.5</td><td></td><td>59.5 63.5 61.4</td><td></td><td>67.4 68.3 67.8</td><td></td><td></td></tr><tr><td></td><td>Pr→Ar</td><td></td><td></td><td>Pr→Cl</td><td></td><td>Pr→Rw</td><td></td><td></td><td>Rw→Ar</td><td></td><td>Rw→Cl</td><td></td><td>Rw→Pr</td><td></td><td>Avg</td></tr><tr><td></td><td>OS* UNK HOS</td><td></td><td></td><td>OS*UNK HOS</td><td></td><td></td><td>OS*UNK HOS</td><td></td><td>OS*UNKHOS</td><td></td><td>OS*UNK HOS</td><td>OS*UNK HOS</td><td></td><td>OS* UNK HOS</td><td></td></tr><tr><td>SHOT 66.3 51.1 57.7</td><td></td><td></td><td></td><td>59.331.040.8</td><td></td><td></td><td>85.8 31.6 46.2</td><td></td><td>73.550.6 59.9</td><td></td><td>65.328.940.1</td><td></td><td>84.4 28.2 42.3</td><td></td><td>74.633.9 45.6</td></tr><tr><td>AaD 47.3 82.4 60.1</td><td></td><td></td><td></td><td>45.4 72.8 55.9</td><td></td><td></td><td>68.472.8 70.6</td><td></td><td>54.579.0 64.6</td><td></td><td>49.069.6 57.5</td><td></td><td>69.770.6 70.1</td><td>58.271.9</td><td>63.6</td></tr></table>
Table 9: Accuracy on Office-Home using ResNet-50 as backbone for Source-free partial-set DA.
<table><tr><td colspan="10">Partial-set DA Ar->C1Ar-→Pr Ar-→Re Cl→ArCl-→PrCl-→RePr→ArPr-→ClPr→Re Re→ArRe-→Cl Re-→Pr Avg.</td></tr><tr><td></td><td>83.6</td><td></td><td>88.8</td><td>72.4</td><td>74.0</td><td>79.0</td><td>76.1</td><td>60.6</td><td>90.1</td><td>81.9</td><td>88.5</td><td>76.8</td></tr><tr><td>SHOT-IM SHOT</td><td>57.9 64.8</td><td>85.2</td><td>92.7</td><td>76.3</td><td>77.6</td><td>88.8</td><td>79.7</td><td>64.3 89.5</td><td>80.6</td><td>68.3 66.4</td><td>85.8</td><td>79.3</td></tr><tr><td>AaD</td><td>67.0</td><td>83.5</td><td>93.1</td><td>80.5</td><td>76.0</td><td>87.6</td><td>78.1 65.6</td><td>90.2</td><td>83.5</td><td>64.3</td><td>87.3</td><td>79.7</td></tr></table>
Source-free partial-set and open-set DA. We provide additional results under source-free partialset and open-set DA (PDA and ODA) setting in Tab. 8 and Tab. 9 respectively, where the open-set detection in ODA follows the same protocol to detect unseen categories as SHOT. On ODA, instead of reporting average per-class accuracy OS = |Cs|×OS∗|C |+1 $\begin{array} { r } { O S = \frac { | \mathcal { C } _ { s } | \times O S ^ { * } } { | \mathcal { C } _ { s } | + 1 } + \frac { 1 \times \bar { U } N K } { | \mathcal { C } _ { s } | + 1 } } \end{array}$ + 1×UNK|C |+1 where |Cs| is the number of known categories on source domain, we report results of HOS = 2×OS∗×UNKOS∗+UNK , which is harmonic mean between known categories accuracy $O S ^ { * }$ and unknown accuracy UNK. As pointed out by [1], $O S$ is problematic since this metric can be quite high even when unknown class accuracy UNK is 0, while unknown category detection is the key part in open-set DA. We reproduce SHOT under open-set DA and report results of $O S ^ { * }$ , UNK and $H O S$ in Tab. 8, which shows our method gets much better balance between known and unknown accuracy.
# 5 Conclusion
We proposed to tackle source-free domain adaptation by encouraging similar features in feature space to have similar predictions while dispersing predictions of dissimilar features in feature space, to achieve simultaneously feature clustering and cluster assignment. We introduced an upper bound to our proposed objective, resulting in two simple terms. Further we showed that we can unify several popular domain adaptation, source-free domain adaptation and contrastive learning methods from the perspective of discriminability and diversity. The approach is simple but achieves state-of-the-art performance on several benchmarks, and can be also adapted to source-free open-set and partial-set domain adaptation.
# Acknowledgement
We acknowledge the support from Huawei Kirin Solution, and the project PID2019-104174GBI00/AEI/10.13039/501100011033 (MINECO, Spain), and the CERCA Programme of Generalitat de Catalunya.
# References
[1] Silvia Bucci, Mohammad Reza Loghmani, and Tatiana Tommasi. On the effectiveness of image rotation for open set domain adaptation. In European Conference on Computer Vision, pages 422–438. Springer, 2020. [2] Jianlong Chang, Lingfeng Wang, Gaofeng Meng, Shiming Xiang, and Chunhong Pan. Deep adaptive image clustering. In ICCV, pages 5879–5887, 2017. [3] Xinyang Chen, Sinan Wang, Mingsheng Long, and Jianmin Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In ICML, pages 1081–1090, 2019. [4] Safa Cicek and Stefano Soatto. Unsupervised domain adaptation via regularized conditional alignment. In ICCV, pages 1416–1425, 2019. [5] Shuhao Cui, Shuhui Wang, Junbao Zhuo, Liang Li, Qingming Huang, and Qi Tian. Towards discriminability and diversity: Batch nuclear-norm maximization under label insufficient situations. CVPR, 2020. [6] Shuhao Cui, Shuhui Wang, Junbao Zhuo, Liang Li, Qingming Huang, and Qi Tian. Fast batch nuclear-norm maximization and minimization for robust domain adaptation. arXiv preprint arXiv:2107.06154, 2021. [7] Zhijie Deng, Yucen Luo, and Jun Zhu. Cluster alignment with a teacher for unsupervised domain adaptation. In ICCV, pages 9944–9953, 2019. [8] Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. With a little help from my friends: Nearest-neighbor contrastive learning of visual representations. ICCV, 2021. [9] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. JMLR, 17(1):2096–2030, 2016. [10] Jacob Goldberger, Geoffrey E Hinton, Sam Roweis, and Russ R Salakhutdinov. Neighbourhood components analysis. NIPS, 17, 2004. [11] Ryan Gomes, Andreas Krause, and Pietro Perona. Discriminative clustering by regularized information maximization. In NIPS, 2010. [12] Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In CVPR, pages 2066–2073. IEEE, 2012. [13] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. [14] Weihua Hu, Takeru Miyato, Seiya Tokui, Eiichi Matsumoto, and Masashi Sugiyama. Learning discrete representations via information maximizing self-augmented training. In ICML, pages 1558–1567, 2017. [15] Jiaxing Huang, Dayan Guan, Aoran Xiao, and Shijian Lu. Model adaptation: Historical contrastive learning for unsupervised domain adaptation without source data. NeurIPS, 34, 2021. [16] Zhizhong Huang, Jie Chen, Junping Zhang, and Hongming Shan. Exploring non-contrastive representation learning for deep clustering. arXiv preprint arXiv:2111.11821, 2021. [17] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. [18] Xu Ji, Joao F Henriques, and Andrea Vedaldi. Invariant information clustering for unsupervised image classification and segmentation. In ICCV, pages 9865–9874, 2019. [19] Ying Jin, Ximei Wang, Mingsheng Long, and Jianmin Wang. Minimum class confusion for versatile domain adaptation. ECCV, 2020. [20] Jogendra Nath Kundu, Naveen Venkat, and R Venkatesh Babu. Universal source-free domain adaptation. CVPR, 2020. [21] Jogendra Nath Kundu, Naveen Venkat, Ambareesh Revanur, R Venkatesh Babu, et al. Towards inheritable models for open-set domain adaptation. In CVPR, pages 12376–12385, 2020. [22] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In CVPR, pages 10285–10295, 2019. [23] Junnan Li, Pan Zhou, Caiming Xiong, and Steven Hoi. Prototypical contrastive learning of unsupervised representations. In ICLR, 2021. [24] Rui Li, Qianfen Jiao, Wenming Cao, Hau-San Wong, and Si Wu. Model adaptation: Unsupervised domain adaptation without source data. In CVPR, pages 9641–9650, 2020. [25] Yunfan Li, Peng Hu, Zitao Liu, Dezhong Peng, Joey Tianyi Zhou, and Xi Peng. Contrastive clustering. In AAAI, 2021. [26] Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? source hypothesis transfer for unsupervised domain adaptation. ICML, 2020. [27] Jian Liang, Dapeng Hu, and Jiashi Feng. Domain adaptation with auxiliary target domain-oriented classifier. In CVPR, pages 16632–16642, 2021. [28] Jian Liang, Dapeng Hu, Ran He, and Jiashi Feng. Distill and fine-tune: Effective adaptation from a black-box source model. CVPR, 2022. [29] Jian Liang, Dapeng Hu, Yunbo Wang, Ran He, and Jiashi Feng. Source data-absent unsupervised domain adaptation through hypothesis transfer and labeling transfer. arXiv preprint arXiv:2012.07297, 2020. [30] Jian Liang, Dapeng Hu, Yunbo Wang, Ran He, and Jiashi Feng. Source data-absent unsupervised domain adaptation through hypothesis transfer and labeling transfer. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. [31] Hong Liu, Jianmin Wang, and Mingsheng Long. Cycle self-training for domain adaptation. In NeurIPS, 2021. [32] Mingsheng Long, Yue Cao, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Transferable representation learning with deep adaptation networks. TPAMI, 41(12):3071–3085, 2018. [33] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. ICML, 2015. [34] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In NIPS, pages 1647–1657, 2018. [35] Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. In NIPS, pages 136–144, 2016. [36] Zhihe Lu, Yongxin Yang, Xiatian Zhu, Cong Liu, Yi-Zhe Song, and Tao Xiang. Stochastic classifiers for unsupervised domain adaptation. In CVPR, pages 9111–9120, 2020. [37] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. [38] Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. TKDE, 22(10):1345–1359, 2009. [39] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017. [40] Simone Romano, James Bailey, Vinh Nguyen, and Karin Verspoor. Standardized mutual information for clustering comparisons: one step further in adjustment for chance. In ICML, pages 1143–1151, 2014. [41] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In ECCV, pages 213–226. Springer, 2010. [42] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, and Kate Saenko. Universal domain adaptation through self supervision. NeurIPS, 33, 2020. [43] Kuniaki Saito, Donghyun Kim, Piotr Teterwak, Stan Sclaroff, Trevor Darrell, and Kate Saenko. Tune it the right way: Unsupervised validation of domain adaptation via soft neighborhood density. In ICCV, pages 9184–9193, 2021. [44] Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In CVPR, pages 3723–3732, 2018. [45] Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. arXiv preprint arXiv:1602.07868, 2016. [46] Yuming Shen, Ziyi Shen, Menghan Wang, Jie Qin, Philip HS Torr, and Ling Shao. You never cluster alone. In NeurIPS, 2021. [47] Rui Shu, Hung H Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. ICLR, 2018. [48] Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. In ICLR, 2015. [49] Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI, 2016. [50] Hui Tang, Ke Chen, and Kui Jia. Unsupervised domain adaptation via structurally regularized deep clustering. In CVPR, pages 8725–8735, 2020. [51] Tsung Wei Tsai, Chongxuan Li, and Jun Zhu. Mice: Mixture of contrastive experts for unsupervised image clustering. In ICLR, 2021. [52] Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In CVPR, pages 7167–7176, 2017. [53] Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014. [54] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In CVPR, pages 5018–5027, 2017. [55] Qin Wang, Olga Fink, Luc Van Gool, and Dengxin Dai. Continual test-time domain adaptation. CVPR, 2022. [56] Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In ICML, pages 9929–9939. PMLR, 2020. [57] Ximei Wang, Liang Li, Weirui Ye, Mingsheng Long, and Jianmin Wang. Transferable attention for domain adaptation. In AAAI, volume 33, pages 5345–5352, 2019. [58] Jianlong Wu, Keyu Long, Fei Wang, Chen Qian, Cheng Li, Zhouchen Lin, and Hongbin Zha. Deep comprehensive correlation mining for image clustering. In ICCV, pages 8150–8159, 2019. [59] Yuan Wu, Diana Inkpen, and Ahmed El-Roby. Dual mixup regularized learning for adversarial domain adaptation. ECCV, 2020. [60] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In CVPR, pages 3733–3742, 2018. [61] Haifeng Xia, Handong Zhao, and Zhengming Ding. Adaptive adversarial network for source-free domain adaptation. In ICCV, pages 9010–9019, 2021. [62] Renjun Xu, Pelen Liu, Liyan Wang, Chao Chen, and Jindong Wang. Reliable weighted optimal transport for unsupervised domain adaptation. In CVPR, pages 4394–4403, 2020. [63] Ruijia Xu, Guanbin Li, Jihan Yang, and Liang Lin. Larger norm more transferable: An adaptive feature norm approach for unsupervised domain adaptation. In ICCV, October 2019. [64] Shiqi Yang, Joost van de Weijer, Luis Herranz, Shangling Jui, et al. Exploiting the intrinsic neighborhood structure for source-free domain adaptation. NeurIPS, 34, 2021. [65] Shiqi Yang, Yaxing Wang, Joost van de Weijer, Luis Herranz, and Shangling Jui. Unsupervised domain adaptation without source data by casting a bait. arXiv preprint arXiv:2010.12427, 2020. [66] Shiqi Yang, Yaxing Wang, Joost van de Weijer, Luis Herranz, and Shangling Jui. Generalized source-free domain adaptation. In ICCV, pages 8978–8987, 2021. [67] Yabin Zhang, Bin Deng, Kui Jia, and Lei Zhang. Label propagation with augmented anchors: A simple semi-supervised learning baseline for unsupervised domain adaptation. In ECCV, pages 781–797, 2020. [68] Yabin Zhang, Hui Tang, Kui Jia, and Mingkui Tan. Domain-symmetric networks for adversarial domain adaptation. In CVPR, pages 5031–5040, 2019. [69] Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In ICML, pages 7404–7413, 2019. [70] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In ICCV, pages 6002–6012, 2019.
# Checklist
1. For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] (b) Did you describe the limitations of your work? [No] (c) Did you discuss any potential negative societal impacts of your work? [No] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
2. If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
3. If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No]
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators? [Yes] (b) Did you mention the license of the assets? [No] (c) Did you include any new assets either in the supplemental material or as a URL? [No] (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
5. If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362# RAMBO-RL: Robust Adversarial Model-Based Offline Reinforcement Learning
Marc Rigter, Bruno Lacerda, Nick Hawes Oxford Robotics Institute University of Oxford {mrigter, bruno, nickh}@robots.ox.ac.uk
# Abstract
Offline reinforcement learning (RL) aims to find performant policies from logged data without further environment interaction. Model-based algorithms, which learn a model of the environment from the dataset and perform conservative policy optimisation within that model, have emerged as a promising approach to this problem. In this work, we present Robust Adversarial Model-Based Offline RL (RAMBO), a novel approach to model-based offline RL. We formulate the problem as a two-player zero sum game against an adversarial environment model. The model is trained to minimise the value function while still accurately predicting the transitions in the dataset, forcing the policy to act conservatively in areas not covered by the dataset. To approximately solve the two-player game, we alternate between optimising the policy and adversarially optimising the model. The problem formulation that we address is theoretically grounded, resulting in a probably approximately correct (PAC) performance guarantee and a pessimistic value function which lower bounds the value function in the true environment. We evaluate our approach on widely studied offline RL benchmarks, and demonstrate that it outperforms existing state-of-the-art baselines.
# 1 Introduction
Reinforcement learning (RL) [61] has achieved state-of-the-art performance on many sequential decision-making problems [40, 45, 59]. However, the need for extensive exploration prohibits the application of RL to many real world domains where such exploration is costly or dangerous. Offline RL [33, 35] overcomes this limitation by learning policies from static, pre-recorded datasets.
Online RL algorithms perform poorly in the offline setting due to the distributional shift between the state-action pairs in the dataset and those taken by the learnt policy. Thus, an important aspect of offline RL is to introduce conservatism to prevent the learnt policy from executing state-action pairs which are out of distribution. Model-free offline RL algorithms [15, 23, 27, 29, 31, 72] train a policy from only the data present in the fixed dataset, and incorporate conservatism either into the value function or by directly constraining the policy.
On the other hand, model-based offline RL algorithms [76, 75, 25, 63, 39] use the dataset to learn a model of the environment, and train a policy using additional synthetic data generated from that model. By training on additional synthetic data, model-based algorithms can potentially generalise better to states not present in the dataset, or to solving new tasks. Previous approaches to model-based offline RL incorporate conservatism by estimating the uncertainty in the model and applying reward penalties for state-action pairs that have high uncertainty [76, 25]. However, uncertainty estimation can be unreliable for neural network models [75, 37]. Like recent work [75], we propose an approach for offline model-based RL which does not require uncertainty estimation.
In this work we present Robust Adversarial Model-Based Offline (RAMBO) RL, a new algorithm for model-based offline RL. RAMBO incorporates conservatism by modifying the transition dynamics of the learnt Markov decision process (MDP) model in an adversarial manner. We formulate the problem of offline RL as a zero-sum game against an adversarial environment. To solve the resulting maximin optimisation problem, we alternate between optimising the agent and optimising the adversary in the style of Robust Adversarial RL (RARL) [50]. Unlike existing RARL approaches, our modelbased approach forgoes the need to define and train an adversary policy, and instead only learns an adversarial model of the MDP. We train the agent policy with an actor-critic algorithm using synthetic data generated from the model in addition to data sampled from the dataset, similar to Dyna [60] and a number of recent methods [22, 76, 25, 75]. We update the environment model so that it reduces the value function for the agent policy, while still accurately predicting the transitions in the dataset. As a result, our approach introduces conservatism by generating pessimistic synthetic transitions for state-action pairs which are out-of-distribution. The theoretical formulation of offline RL that our algorithm addresses yields a PAC bound for the performance gap with respect to any policy covered by the dataset, and a pessimistic value function that lower bounds the value function in the true environment.
In summary, the main contributions of this work are:
• RAMBO, a novel and theoretically-grounded model-based offline RL algorithm which enforces conservatism by training an adversarial dynamics model. • Adapting the Robust Adversarial RL approach to model-based offline RL by proposing a new formulation of RARL, where instead of defining and training an adversary policy, we directly train the model adversarially.
In our experiments we demonstrate that RAMBO outperforms current state-of-the-art algorithms on the D4RL benchmarks [14]. Furthermore, we provide ablation results which show that training the model adversarially is crucial to the strong performance of RAMBO.
# 2 Related Work
Offline RL: Offline RL addresses the problem of learning policies from fixed datasets, and has been applied to domains such as healthcare [42, 57], natural language processing [24, 23], and robotics [30, 38, 51]. Model-free offline RL algorithms do not require a learnt model. Approaches for model-free offline RL include importance sampling algorithms [36, 41], constraining the learnt policy to be similar to the behaviour policy [16, 28, 72, 23, 58, 15], incorporating conservatism into the value function during training [9, 27, 31, 73], using uncertainty quantification to generate more robust value estimates [1, 2, 29], or applying only a single iteration of policy iteration [7, 49]. In contrast, modelbased approaches learn a model of the environment and generate synthetic data from that model [60] to optimise a policy using either planning [4] or RL algorithms [25, 76, 75]. By training a policy on additional synthetic data, model-based approaches have the potential for broader generalisation and for solving new tasks [6, 76]. A simple approach to ensuring conservatism is to constrain the policy to be similar to the behaviour policy in the same fashion as some model-free approaches [8, 39, 63]. Another approach is to apply reward penalties for executing state-action pairs with high uncertainty in the environment model [25, 74, 76]. However, this requires explicit uncertainty estimates which may be unreliable for neural network models [17, 37, 46, 75]. COMBO [75] obviates the need for uncertainty estimation in model-based offline RL by adapting model-free techniques [31] to regularise the value function for out-of-distribution samples. Like COMBO, our approach does not require uncertainty estimation.
Most approaches to model-based offline RL use maximum likelihood estimates (MLE) of the MDP trained using standard supervised learning [4, 39, 63, 76, 75]. However, other methods have been proposed to learn models which are more suitable for offline policy optimisation. One approach is to reweight the loss function to ensure the model is accurate under the state-action distribution generated by the policy [34, 53, 20]. In contrast, our approach produces pessimistic synthetic transitions when out-of-distribution.
Most related to our work is a recent paper [66] which introduces the maximin formulation of offline RL that we address. This existing work motivates our approach theoretically by showing that the problem formulation obtains probably approximately correct (PAC) guarantees. However, [66] only addresses the theoretical aspects of the problem formulation and does not propose a practical algorithm. In this work, we propose a practical RL algorithm to solve the maximin formulation of model-based offline RL.
Robust RL: Algorithms for Robust MDPs [5, 12, 21, 43, 54, 64, 70] find the policy with the best worst-case performance over a set of possible MDPs. Typically, it is assumed that the uncertainty set of MDPs is specified a priori. To eliminate the need to specify the set of possible MDPs, model-free approaches to Robust MDPs [68, 55] instead assume that samples can be drawn from a misspecified MDP which is similar to the true MDP. As our work addresses offline RL, we assume that we have a fixed dataset from the true MDP.
Our approach is conceptually similar to Robust Adversarial RL (RARL) [50], a method proposed to improve the robustness of RL policies in the online setting. RARL is posed as a two-player zero-sum game where the agent plays against an adversary which perturbs the environment. Formulations of model-free RARL differ in how they define the action space of the adversary. Options include allowing the adversary to apply perturbation forces to the simulator [50], add noise to the agent’s actions [65], or periodically take over control [48]. A model-based approach to RARL is proposed in [13], which learns an optimistic and pessimistic model to encourage online exploration. However, this existing approach requires uncertainty estimation as well as an adversarial policy to be learnt in addition to the model. Our work follows the paradigm of RARL and alternates between agent and adversarial updates in a maximin formulation. We adapt model-based RARL to the offline setting and propose an alternative formulation: we eliminate the need to learn an adversary policy and instead directly modify the MDP model adversarially.
# 3 Preliminaries
MDPs and Offline RL: An MDP is defined by the tuple, $M = ( S , A , T , R , \mu _ { 0 } , \gamma )$ . $S$ and $A$ denote the state and action spaces respectively, $R ( s , a )$ is the reward function, $T ( s ^ { \prime } | s , a )$ is the transition function, $\mu _ { 0 }$ is the initial state distribution, and $\gamma \in \mathsf { \Gamma } ( 0 , 1 )$ is the discount factor. In this work we consider Markovian policies, $\pi \in \Pi$ , which map from each state to a distribution over actions. We denote the (improper) discounted state visitation distribution of a policy by $\begin{array} { r } { d _ { M } ^ { \pi } ( s ) : = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \operatorname* { P r } ( s _ { t } = s | \pi , \bar { M } ) } \end{array}$ , where $\mathrm { P r } ( s _ { t } = s | \pi , M )$ is the probability of reaching state $s$ at time $t$ by executing policy $\pi$ in $M$ . The improper state-action visitation distribution is $d _ { M } ^ { \pi } \bar { ( } s , a ) =$ $\pi ( a | s ) \cdot d _ { M } ^ { \pi } ( s )$ . We also denote the normalised state-action visitation distribution by $\tilde { d } _ { M } ^ { \pi } ( s , a ) =$ $( 1 - \gamma ) \cdot d _ { M } ^ { \pi } ( s , a )$ .
The value function, $V _ { M } ^ { \pi } ( s )$ , represents the expected discounted return from executing $\pi$ from state $s$ in $\begin{array} { r } { M \colon V _ { M } ^ { \pi } ( s ) = \mathbb { E } _ { \pi , M } \bigl [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) \bigr ] } \end{array}$ . We write $V _ { M } ^ { \pi }$ to indicate the value function under the initial state distribution, i.e. $\begin{array} { r } { V _ { M } ^ { \pi } = \sum _ { s \in S } \mu _ { 0 } ( s ) V _ { M } ^ { \pi } ( s ) } \end{array}$ . The standard objective for MDPs is to find the policy which maximises $V _ { M } ^ { \pi }$ . The state-action value function, $Q _ { M } ^ { \pi } ( s , a )$ , is the expected discounted cumulative reward from taking action $a$ at state $s$ and then executing $\pi$ thereafter.
In offline RL we only have access to a fixed dataset of transitions from the MDP, $\begin{array} { r l } { \mathcal { D } } & { { } = } \end{array}$ $\{ ( s _ { i } , a _ { i } , r _ { i } , s _ { i } ^ { \prime } ) \} _ { i = 1 } ^ { | \mathcal { D } | }$ . The goal of offline RL is to find the best possible policy using the fixed dataset.
Model-Based Offline RL Algorithms: Model-based approaches to offline RL use a model of the MDP to help train a policy. The dataset is used to learn a dynamics model, $\widehat { T }$ , which is typically trained via maximum likelihood estimation: $\begin{array} { r } { \operatorname* { m i n } _ { \widehat { T } } \mathbb { E } _ { ( s , a , s ^ { \prime } ) \sim \mathcal { D } } \big [ - \log \widehat { T } ( s ^ { \prime } | s , a ) \big ] } \end{array}$ . A model of the reward function, $\widehat { R } ( s , a )$ , can also be learnt if it is unknown. The estimated MDP, $\widehat { M } = ( S , A , \widehat { T } , \widehat { R } , \mu _ { 0 } , \gamma )$ , has the same state and action space as the true MDP but uses the learnt transition and reward functions. Thereafter, any planning or RL algorithm can be used to recover optimal policy in the learnt model, $\widehat { \pi } = \arg \operatorname* { m a x } _ { \pi \in \Pi } V _ { \widehat { M } } ^ { \pi } .$ ·
Unfortunately, directly applying this approach to the offline RL setting does not perform well due to distributional shift. In particular, if the dataset does not cover the entire state-action space, the model will inevitably be inaccurate for some state-action pairs. Thus, naive policy optimisation on a learnt model in the offline setting can result in model exploitation [22, 32, 53]. To mitigate this issue, we propose the novel approach of enforcing conservatism by adversarially modifying the transition dynamics of $\widehat { M }$ .
In line with existing works [76, 75, 8], we use model-based policy optimisation (MBPO) [22] to learn the optimal policy for $\widehat { M }$ . MBPO utilises a standard actor-critic RL algorithm. However, the value function is trained using an augmented dataset ${ \mathcal { D } } \cup { \mathcal { D } } _ { \widehat { M } }$ , where $\mathcal { D } _ { \widehat { M } }$ is synthetic data generated c cby simulating rollouts in the learnt model. To generate the synthetic data, MBPO performs $k$ -step rollouts in $\widehat { M }$ starting from states $s \in \mathcal { D }$ , and adds this data to $\mathcal { D } _ { \widehat { M } }$ . To train the policy, minibatches of data are drawn from $\mathcal { D } \cup \mathcal { D } _ { \widehat { M } }$ c, where each datapoint is sampled from the real data, $\mathcal { D }$ , with probability $f$ , and from $\mathcal { D } _ { \widehat { M } }$ cwith probability $1 - f$ .
Robust Adversarial Reinforcement Learning: RARL addresses the problem of finding a robust agent policy, $\pi$ , in the online RL setting by posing the problem as a two-player zero sum game against adversary policy, $\bar { \pi }$ :
$$\pi = \arg \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { m i n } _ { \bar { \pi } \in \bar { \Pi } } V _ { M } ^ { \pi , \bar { \pi } }$$
wher e V π,π¯ is the expected value from executing $\pi$ and $\bar { \pi }$ in environment $M$ . Different approaches define the action space for $\bar { \pi }$ in different ways, as discussed in Section 2. For a scalable approximation to the optimisation problem in Equation 1, algorithms for RARL alternate between applying steps of stochastic gradient ascent to the agent’s policy to increase the expected value, and stochastic gradient descent to the adversary’s policy to decrease the expected value. In our work, we follow the RARL paradigm of alternating between agent and adversarial updates and adapt it to the model-based offline setting. Instead of defining a separate adversary policy, we treat the model itself as the policy to be adversarially trained.
# 4 Problem Formulation
For the sake of generality, we assume that both the transition function and reward function are unknown. Hereafter, we write $\widehat { T }$ to denote both the learnt dynamics and reward function, where $\widehat { T } ( s ^ { \prime } , r | s , a )$ is the probability of receiving reward $r$ and transitioning to $s ^ { \prime }$ after executing $( s , a )$ . We address the maximin formulation of offline RL recently proposed by [66]:
Problem 1. For some dataset, $\mathcal { D }$ , and some fixed constant $\xi > 0$ , find the policy $\pi$ defined by
$$\begin{array} { r } { \mathcal { M } _ { \mathcal { D } } = \Big \{ \widehat { T } \ : | \mathbb { E } _ { \mathcal { D } } \big [ \mathbf { T V } ( \widehat { T } _ { \mathrm { M L E } } ( \cdot | s , a ) , \widehat { T } ( \cdot | s , a ) ) ^ { 2 } \big ] \leq \xi \Big \} , } \end{array}$$
where $\mathrm { T V } ( P _ { 1 } , P _ { 2 } )$ is the total variation distance between distributions $P _ { 1 }$ and $P _ { 2 }$ , and $\widehat { T } _ { \mathrm { M L E } }$ denotes the maximum likelihood estimate of the MDP given the offline dataset, $\mathcal { D }$ .
Thus, the set defined in Equation 3 contains MDPs which are similar to the maximum likelihood estimate under state-action pairs in $\mathcal { D }$ . However, because the expectation in Equation 3 is taken under $\mathcal { D }$ , there is no restriction on $\widehat { T }$ for regions of the state-action space not covered by $\mathcal { D }$ . We present a brief overview of the theoretical guarantees from [66] in the following subsection.
Remark 1. Note that Problem 1 differs from the pessimistic MDP formulations introduced by MOPO [76] and MOReL [25]. Problem 1 considers the worst-case transition dynamics, while the pessimistic MDPs constructed by MOPO and MOReL only modify the reward function by applying reward penalties for state-action pairs with high uncertainty.
# 4.1 Theoretical Motivation
The theoretical analysis from [66] shows that solving Problem 1 outputs a policy that with high probability is approximately as good as any policy with a state-action distribution that is covered by the dataset. This is formally stated in the following theorem.
Theorem 1 (PAC guarantee from [66], Theorem 5). Denote the true MDP transition function by $T$ and let $\mathcal { M }$ denote a hypothesis class of MDP models such that $T \in { \mathcal { M } }$ . Let $\pi$ denote the solution to Problem 1 for dataset $\mathcal { D }$ . Then with probability $1 - \delta$ for any policy, $\pi ^ { * } \in \Pi$ , we have
$${ V _ { T } ^ { \pi ^ { * } } } - { V _ { T } ^ { \pi } } \leq ( 1 - \gamma ) ^ { - 2 } c _ { 1 } \sqrt { C _ { \pi ^ { * } } } \sqrt { G _ { \mathcal M _ { 1 } } + G _ { \mathcal M _ { 2 } } + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { | \mathcal D | } } , \ w h e r e$$
$$C _ { \pi ^ { * } } = \operatorname* { m a x } _ { T ^ { \prime } \in \mathcal { M } } \frac { \mathbb { E } _ { ( s , a ) \sim \tilde { d } _ { T } ^ { \pi ^ { * } } } \left[ \mathrm { T V } ( T ^ { \prime } ( \cdot | s , a ) , T ( \cdot | s , a ) ) ^ { 2 } \right] } { \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \mathrm { T V } ( T ^ { \prime } ( \cdot | s , a ) , T ( \cdot | s , a ) ) ^ { 2 } \right] } ,$$
where $\rho$ is the state-action distribution from which $\mathcal { D }$ was sampled, and c and $c _ { 1 }$ are universal constants. We refer the reader to Appendix $A$ of [66] for the definitions of $G _ { \mathcal { M } _ { 1 } }$ , $G _ { \mathcal { M } _ { 2 } }$ , and $\xi _ { n }$ .
The quantity $C _ { \pi ^ { * } }$ is upper bounded by the maximum density ratio between the comparator policy, $\pi ^ { * }$ , and the offline distribution, i.e. $C _ { \pi ^ { * } } ^ { \mathrm { ~ \bar { ~ } } } \le \operatorname* { m a x } _ { ( s , a ) } \tilde { d } _ { T } ^ { \pi ^ { * } } ( s , a ) / \rho ( s , a )$ . It represents the discrepancy between the distribution of data in the dataset compared to the visitation distribution of policy $\pi ^ { * }$ . Theorem 1 shows that if we find a policy by solving Problem 1, the performance gap of that policy is bounded with respect to any other policy $\pi ^ { * }$ that has a state-action distribution which is covered by the dataset.
Furthermore, the value function under the worst-case model in the set defined by Problem 1 is a lower bound on the value function in the true environment, as stated by Proposition 1.
Proposition 1 (Pessimistic value function). Let $T$ denote the true transition function for some MDP, and let $\mathcal { M } _ { \mathcal { D } }$ be the set of MDP models defined in Equation 3. Then for any policy $\pi$ , with probability $1 - \delta$ we have that
$$\operatorname* { m i n } _ { \widehat { T } \in \mathcal { M } _ { \mathcal { D } } } V _ { \widehat { T } } ^ { \pi } \leq V _ { T } ^ { \pi } .$$
Proposition 1 follows from the fact that $T \in \mathcal { M } _ { \mathcal { D } }$ with high probability, which is proven in [66] (Appendix E.2). Proposition 1 shows that we can expect the performance of any policy in the true MDP to be at least as good as the value in the worst-case model defined in Problem 1.
While [66] provides the theoretical motivation for solving Problem 1, it does not propose a practical algorithm. In this work, we focus on developing a practical approach to solving Problem 1.
# 5 RAMBO-RL
In this section, we present Robust Adversarial Model-Based Offline RL (RAMBO), our algorithm for solving Problem 1. The main difficulty with solving Problem 1 is that it is unclear how to find the worst-case MDP in the set defined in Equation 3. To arrive at a scalable solution, we propose a novel approach which is in the spirit of RARL. We alternate between optimising the agent policy to increase the expected value, and adversarially optimising the model to decrease the expected value. In this section, we first describe how we compute the gradient to adversarially train the model. Then, we discuss how to ensure that the model remains approximately within the constraint set defined in Problem 1. Finally, we present our overall algorithm.
# 5.1 Model Gradient
We propose a policy gradient-inspired approach to adversarially optimise the model. Typically, policy gradient algorithms are used to modify the distribution over actions taken by a policy at each state [62, 71]. In contrast, the update that we propose modifies the likelihood of the successor states and rewards in the MDP model.
We assume that the MDP model is defined by parameters, $\phi$ , and we write $\widehat { T } _ { \phi }$ to indicate this. We denote by V πφ the value function for policy π in model Tbφ. To approximately find minTφ∈MD as required by Problem 1 via gradient descent, we wish to compute the gradient of the model parameters that reduces the value of the policy within the model, i.e. $\nabla _ { \phi } V _ { \phi } ^ { \pi }$ .
Proposition 2 (Model Gradient). Let $\phi$ denote the parameters of a parametric MDP model $\widehat { T } _ { \phi }$ , and let $V _ { \phi } ^ { \pi }$ denote the value function for policy $\pi$ in $\widehat { T } _ { \phi }$ . Then:
$$\nabla _ { \phi } V _ { \phi } ^ { \pi } = \mathbb { E } _ { s \sim d _ { \phi } ^ { \pi } , a \sim \pi , ( s ^ { \prime } , r ) \sim \widehat { T } _ { \phi } } \left[ ( r + \gamma V _ { \phi } ^ { \pi } ( s ^ { \prime } ) ) \cdot \nabla _ { \phi } \log \widehat { T } _ { \phi } ( s ^ { \prime } , r | s , a ) \right]$$
The proof of Proposition 2 is given in Appendix A. We can subtract the baseline $Q _ { \phi } ^ { \pi } ( s , a )$ without biasing the gradient estimate (see Appendix A.1 for details):
$$\begin{array} { r } { \nabla _ { \phi } V _ { \phi } ^ { \pi } = \mathbb { E } _ { s \sim d _ { \phi } ^ { \pi } , a \sim \pi , ( s ^ { \prime } , r ) \sim \widehat { T } _ { \phi } } \left[ \left( r + \gamma V _ { \phi } ^ { \pi } ( s ^ { \prime } ) - Q _ { \phi } ^ { \pi } ( s , a ) \right) \cdot \nabla _ { \phi } \log \widehat { T } _ { \phi } ( s ^ { \prime } , r | s , a ) \right] } \end{array}$$
The Model Gradient differs from the standard policy gradient in that a) it is used to update the likelihood of successor states in the model, rather than actions in a policy, and b) the “advantage” term $r + \gamma V _ { \phi } ^ { \pi } ( s ^ { \prime } ) - Q _ { \phi } ^ { \pi } ( s , a )$ compares the utility of receiving reward $r$ and transitioning to $s ^ { \prime }$ to the expected value of state action pair $( s , a )$ . In contrast, the standard advantage term, $Q ( s , a ) - V ( s )$ [56], compares the value of executing state-action pair $( s , a )$ to the value at $s$ . To estimate $V _ { \phi } ^ { \pi }$ and $Q _ { \phi } ^ { \pi }$ , we use the critic learnt by the actor-critic algorithm used for policy optimisation. Thus, we use the critic both for training the policy and adversarially training the model.
Remark 2. The Model Gradient can be thought of as a specific instantiation of the policy gradient if we view $\widehat { T } _ { \phi }$ as a adversarial “policy” on an augmented MDP, $M ^ { + }$ , i.e. $\widehat { T } _ { \phi } : S ^ { + } \to \operatorname { D i s t } ( A ^ { + } )$ . The augmented state space, $S ^ { + } = \bar { S } \times \bar { A }$ includes the state in the original MDP augmented by the action taken by the agent. The augmented action space consists of the reward applied and the successor state, $A ^ { + } = S \times [ R _ { \operatorname* { m i n } } , R _ { \operatorname* { m a x } } ]$ . Thus, we can think of this approach as an instantiation of RARL in which the adversary policy $\bar { \pi }$ in Equation 1) that we train is the model itself.
# 5.2 Adversarial Model Training
If we were to update the model using Equation 5 alone, this would allow the model to be modified arbitrarily such that the value function in the model is reduced. However, the set of plausible MDPs given by Equation 3 states that over the dataset, $\mathcal { D }$ , the model $\widehat { T } _ { \phi }$ should be close to the maximum likelihood estimate, $\widehat { T } _ { \mathrm { M L E } }$ . Specifically, in the inner optimisation of Problem 1 we wish to find a solution to the constrained optimisation problem
$$\operatorname* { m i n } _ { \widehat { T } _ { \phi } } V _ { \phi } ^ { \pi } , \quad s . t . \mathbb { E } _ { \mathcal { D } } \big [ \mathbf { T V } ( \widehat { T } _ { \mathrm { M L E } } ( \cdot | s , a ) , \widehat { T } _ { \phi } ( \cdot | s , a ) ) ^ { 2 } \big ] \leq \xi .$$
The Lagrangian relaxation leads to the unconstrained problem
$$\operatorname* { m a x } _ { \lambda \geq 0 } \operatorname* { m i n } _ { \hat { T } _ { \phi } } \Big ( L ( \hat { T } , \lambda ) : = V _ { \phi } ^ { \pi } + \lambda \big ( \mathbb { E } _ { \mathcal { D } } \big [ \mathrm { T V } ( \hat { T } _ { \mathrm { M L E } } ( \cdot \vert s , a ) , \hat { T } _ { \phi } ( \cdot \vert s , a ) ) ^ { 2 } \big ] - \xi \big ) \Big ) ,$$
where $\lambda$ is the Lagrange multiplier. Rather than optimising the Lagrange multiplier, we find that in practice fixing $\lambda$ to apply a constant weighting between the two terms works well with minimal tuning. To facilitate easier tuning of the learning rate, in our implementation we apply the weighting constant to the value function term rather than the model term, which is equivalent up to a scaling factor. This leads to
$$\begin{array} { r } { \underset { \widehat { T } _ { \phi } } { \operatorname* { m i n } } \left( \lambda V _ { \phi } ^ { \pi } + \mathbb { E } _ { \mathcal { D } } \left[ \Gamma \mathbf { V } ( \widehat { T } _ { \mathrm { M L E } } ( \cdot | s , a ) , \widehat { T } _ { \phi } ( \cdot | s , a ) ) ^ { 2 } \right] \right) . } \end{array}$$
We aim to make our algorithm efficient and simple to implement. Therefore, rather than minimising the TV distance between the model and MLE model as prescribed by Equation 8, we directly optimise the standard MLE loss. This leads to the final loss function:
$$\begin{array} { r } { \mathcal { L } _ { \phi } = \lambda V _ { \phi } ^ { \pi } - \mathbb { E } _ { ( s , a , r , s ^ { \prime } ) \sim \mathcal { D } } \left[ \log \widehat { T } _ { \phi } ( s ^ { \prime } , r | s , a ) \right] . } \end{array}$$
Thus, the loss function for the model in Equation 9 simply adds the adversarial term to the standard MLE loss. By minimising the loss function in Equation 9, the model is trained to a) predict the transitions within the dataset, and b) reduce the value function of the policy, with $\lambda$ determining the tradeoff between these two objectives. Choosing $\lambda$ to be small ensures that the MLE term dominates for transitions within $\mathcal { D }$ , ensuring that the model fits the dataset accurately. Because the MLE term is only computed over $\mathcal { D }$ , the adversarial term dominates outside of the dataset meaning that the model is modified adversarially for transitions outside of the dataset.
To estimate the gradient of the loss function in Equation 9 for stochastic gradient descent, we sample a minibatch of transitions from $\mathcal { D }$ to estimate the MLE term. The gradient for the value function term is computed using the Model Gradient. The transitions used to compute the Model Gradient term must be sampled under the current policy and model (Equation 5). Therefore, to estimate the Model Gradient term, we generate a minibatch of transitions by simulating the current policy in $\widehat { T } _ { \phi }$ .
Like previous works [10, 76, 75, 8], we represent the dynamics model using an ensemble of neural networks. Each neural network produces a Gaussian distribution over the next state and reward:
$\widehat { T } _ { \phi } ( s ^ { \prime } , r | s , a ) = \mathcal { N } ( \mu _ { \phi } ( s , a ) , \Sigma _ { \phi } ( s , a ) )$ . A visualisation of the result of adversarially training the dynamics model can be found in Appendix C.3.
Normalisation The composite loss function in Equation 9 comprises two terms which may have different magnitudes across domains depending on the scale of the states and rewards. To enable easier tuning of the adversarial loss weighting, $\lambda$ , across different domains we perform the following normalisation procedure. Prior to training, we normalise the states in $\mathcal { D }$ in the manner proposed in [15], by subtracting the mean and dividing by the standard deviation of each state dimension in the dataset. Additionally, when computing the gradient in Equation 5 we normalise the advantage terms, $r + \gamma V _ { \phi } ^ { \pi } ( s ^ { \prime } ) - \dot { Q _ { \phi } ^ { \pi } } ( s , a )$ , according to the mean and standard deviation across each minibatch. Advantage normalisation is common practice in policy gradient RL implementations [3, 52].
# 5.3 Algorithm
We are now ready to present our overall approach in Algorithm 1. The first step of RAMBO is to pretrain the environment dynamics model using standard MLE (Line 1). Thereafter, the algorithm follows the format of RARL. At each iteration, we apply gradient updates to the agent to increase the expected value, followed by gradient updates to the model to decrease the expected value.
Prior to each agent update, we generate synthetic $k$ -step rollouts starting from states in $\mathcal { D }$ by simulating rollouts in the current MDP model $\widehat { T } _ { \phi }$ . This data is added to the synthetic dataset $\mathcal { D } _ { \widehat { T } _ { \phi } }$ (Line 3). Following previous approaches [76, 75, 22] we only store data from recent iterations in $\mathcal { D } _ { \widehat { T } _ { \phi } }$ . The agent’s policy and value functions are trained with an off-policy actor-critic algorithm using samples from $\mathcal { D } \cup \mathcal { D } _ { \widehat { T } _ { \phi } }$ (Line 4). In our implementation, we use soft actor-critic (SAC) [19] for agent training. To update the model to minimise the loss in Equation 9 (Line 5), we sample data from $\mathcal { D }$ to estimate the gradient for the MLE component. To compute the adversarial component we generate samples by simulating the current policy and model, and utilise the value function learnt by the agent to compute the gradient according to Equation 5.
# Algorithm 1 RAMBO-RL
Require: Normalised dataset, $\mathcal { D }$ ; 1: $\widehat { T } _ { \phi } \gets \mathrm { M L E }$ dynamics model. 2: for $i = 1 , 2 , \dots , n _ { \mathrm { i t e r } } ,$ do 3: Generate synthetic $k$ -step rollouts. Add transition data to $\mathcal { D } _ { \widehat { T } _ { \phi } }$ . 4: Agent update: Update $\pi$ and $Q _ { \phi } ^ { \pi }$ Tbφwith an actor critic algorithm, using samples from $\mathcal { D } \cup \mathcal { D } _ { \widehat { T } _ { \phi } }$ . 5: Adversarial model update: Update $\widehat { T } _ { \phi }$ according to Eq. 9, using samples from $\mathcal { D }$ for the MLE component, and the current critic $Q _ { \phi } ^ { \pi }$ and synthetic data sampled from $\pi$ and $\widehat { T } _ { \phi }$ for the adversarial component.
# 6 Experiments
In our experiments, we aim to: a) evaluate how well RAMBO performs compared to state-ofthe-art baselines, b) examine whether RAMBO can be tuned offline, c) determine the impact of adversarial training on the performance of the algorithm, and d) investigate the difference between RAMBO and COMBO, the most similar prior algorithm. The code for our experiments is available at github.com/marc-rigter/rambo. We evaluate our approach on the following domains.
MuJoCo There are three different environments representing different robots (HalfCheetah, Hopper, Walker2D), each with 4 datasets (Random, Medium, Medium-Replay, Medium-Expert). Random contains transitions collected by a random policy. Medium contains transitions collected by an early-stopped SAC policy. Medium-Replay consists of the replay buffer generated while training the Medium policy. The Medium-Expert dataset contains a mixture of suboptimal and expert data.
AntMaze The agent controls a robot and navigates to reach a goal, receiving a sparse reward only if the goal is reached. There are three different layouts of maze (Umaze, Medium, Large), and different dataset types (Fixed, Play, Diverse) which differ in terms of the variety of start and goal locations used to collect the dataset. The MuJoCo and AntMaze benchmarks are from D4RL [14].
Hyperparameter Details The base hyperparameters that we use for RAMBO mostly follow those used in SAC [19] and COMBO [75]. We find that the performance of RAMBO is sensitive to the choice of rollout length, $k$ , consistent with findings in previous works [22, 37]. The other critical parameter for RAMBO is the choice of the adversarial weighting, $\lambda$ .
For each dataset, we choose the rollout length and the adversarial weighting from one of three possible configurations: $( k , \lambda ) \in \{ ( 2 , 3 { \mathrm { e } } { - } 4 ) , ( 5 , 3 { \bar { \mathrm { e } } } { - } 4 ) , ( 5 , 0 ) \}$ . We included $\bar { ( k , \lambda ) } = ( 5 , 0 )$ as we found that an adversarial weighting of 0 worked well for some datasets. For the MuJoCo datasets we performed model rollouts using the current policy, and initialised the policy using behaviour cloning (BC) which is a common practice in offline RL [25, 74]. Ablation results in Appendix C.4 indicate that the BC initialisation results in a small improvement. For the AntMaze datasets we used a random rollout policy and a randomly initialised policy as we found that this performed better. Further details about the hyperparameters are in Appendix B.
Evaluation We present two different evaluations of our approach: RAMBO and RAMBOOFF. For RAMBO, we ran each of the three hyperparameter configurations for five seeds each, and report the best performance across the three configurations. Thus, our evaluation of RAMBO utilises limited online tuning which is the most common practice among existing model-based offline RL algorithms [25, 37, 39, 76]. The performance obtained for each of the hyperparameter configurations is included in Appendix C.2.
Offline hyperparameter selection is an important topic in offline RL [47, 77]. Therefore, we present additional results for RAMBOOFF where we select between the three choices of hyperparameters offline using a simple heuristic (details in Appendix B.5) based on the magnitude and stability of the $Q$ -values during offline training. We first select the hyperparameters using the heuristic, and then rerun each dataset for 5 seeds to generate the results for RAMBOOFF.
Baselines We compare RAMBO against state-of-the-art model-based (COMBO [75], RepBSDE [34], MOReL [25], and MOPO [76]) and model-free (CQL [31], IQL [28], and $\mathrm { T D } 3 { + } \mathrm { B C }$ [15]) offline RL algorithms. We provide results for all algorithms for the MuJoCo-v2 D4RL datasets and the AntMaze-v0 datasets (details in Appendix B.7).
# 6.1 Results
D4RL Performance The results in Table 1 show that RAMBO achieves the best total score for the MuJoCo locomotion domains, outperforming existing state-of-the-art methods. Furthermore, RAMBO obtains the best overall score on both the Medium and Medium-Replay dataset types. For the random datasets, RAMBO is outperformed only by MOReL. This shows that RAMBO performs very well for datasets that are either noisy or consist of suboptimal data.
For the Medium-Expert datasets, RAMBO is outperformed by most of the baseline algorithms, suggesting that RAMBO is less suitable for high-quality datasets. However, for the Medium-Expert datasets, simpler approaches such as performing behaviour cloning on the best $10 \%$ of trajectories can be used to achieve stronger performance than offline RL methods [28]. Therefore, the suboptimal performance of RAMBO on the Medium-Expert datasets is less of a concern, as applying offline RL algorithms may not be the most suitable approach for these high-quality datasets.
For AntMaze, the model-based algorithms perform considerably less well than the model-free approaches. Unlike the other model-based approaches, RAMBO at least scores greater than zero for most of the datasets. Our results echo previous findings that model-based approaches struggle to perform well in the AntMaze domains, potentially because model-based algorithms are too aggressive and collide with walls [67]. Recent work [67] showed that reverse rollouts can lead to stronger performance for model-based methods in these domains. In future work, we wish to investigate whether combining RAMBO with reverse rollouts improves the performance for AntMaze.
Offline Tuning In Table 1, we also present results for RAMBOOFF where the final hyperparameters are chosen using the heuristic described in Appendix B.5. We see that there is a slight degradation in the performance relative to RAMBO, which uses online tuning. However, RAMBOOFF still achieves comparable performance to the best existing approaches on the MuJoCo datasets. This suggests that suitable hyperparameters for RAMBO can reliably be chosen using our offline heuristic.
Table 1: Results for the D4RL benchmark using the normalisation procedure proposed by [14]. We report the normalised performance during the last 10 iterations of training averaged over 5 seeds. $\pm$ captures the standard deviation over seeds. Highlighted numbers indicate results within $2 \%$ of the most performant algorithm. \* indicates the total without random datasets.
<table><tr><td colspan="2"></td><td colspan="2">Ours</td><td colspan="4">Model-based baselines</td><td colspan="3">Model-free baselines</td><td></td></tr><tr><td colspan="2"></td><td>RAMBO</td><td>RAMBOOFF|</td><td>RepB-SDE COMBO MOPO MOReL</td><td></td><td></td><td></td><td>CQL</td><td>IQL</td><td>TD3+BC</td><td>BC</td></tr><tr><td rowspan="3">aapaem</td><td>HalfCheetah</td><td>40.0 ± 2.3</td><td>33.5 ± 2.6</td><td>32.9</td><td>38.8</td><td>35.4</td><td>25.6</td><td>19.6</td><td>1</td><td>11.0</td><td>2.1</td></tr><tr><td>Hopper</td><td>21.6 ± 8.0</td><td>15.5± 9.4</td><td>8.6</td><td>17.9</td><td>4.1</td><td>53.6</td><td>6.7</td><td>-</td><td>8.5</td><td>9.8</td></tr><tr><td>Walker2D</td><td>11.5 ± 10.5</td><td>0.2±0.6</td><td>21.1</td><td>7.0</td><td>4.2</td><td>37.3</td><td>2.4</td><td>-</td><td>1.6</td><td>1.6</td></tr><tr><td rowspan="3">Waiea</td><td>HalfCheetah</td><td>77.6 ± 1.5</td><td>71.0 ± 3.0</td><td>49.1</td><td>54.2</td><td>69.5</td><td>42.1</td><td>49.0</td><td>47.4</td><td>48.3</td><td>36.1</td></tr><tr><td>Hopper</td><td>92.8± 6.0</td><td>91.2 ± 16.3</td><td>34.0</td><td>94.9</td><td>48.0</td><td>95.4</td><td>66.6</td><td>66.3</td><td>59.3</td><td>29.0</td></tr><tr><td>Walker2D</td><td>86.9 ± 2.7</td><td>89.1 ± 2.7</td><td>72.1</td><td>75.5</td><td>-0.2</td><td>77.8</td><td>83.8</td><td>78.3</td><td>83.7</td><td>6.6</td></tr><tr><td rowspan="3">nipea Aerder</td><td>HalfCheetah</td><td>68.9 ± 2.3</td><td>67.0 ± 1.5</td><td>57.5</td><td>55.1</td><td>68.2</td><td>40.2</td><td>47.1</td><td>44.2</td><td>44.6</td><td>38.4</td></tr><tr><td>Hopper</td><td>96.6± 7.0</td><td>97.6± 3.4</td><td>62.2</td><td>73.1</td><td>39.1</td><td>93.6</td><td>97.0</td><td>94.7</td><td>60.9</td><td>11.8</td></tr><tr><td>Walker2D</td><td>85.0 ± 15.0</td><td>88.5± 4.0</td><td>49.8</td><td>56.0</td><td>69.4</td><td>49.8</td><td>88.2</td><td>73.9</td><td>81.8</td><td>11.3</td></tr><tr><td rowspan="3">wnipen dx</td><td>HalfCheetah</td><td>93.7± 10.5</td><td>79.3 ± 2.9</td><td>55.4</td><td>90.0</td><td>72.7</td><td>53.3</td><td>90.8</td><td>86.7</td><td>90.7</td><td>35.8</td></tr><tr><td>Hopper</td><td>83.3± 9.1</td><td>89.5 ± 11.1</td><td>82.6</td><td>111.1</td><td>3.3</td><td>108.7</td><td>106.8</td><td>91.5</td><td>98.0</td><td>111.9</td></tr><tr><td>Walker2D</td><td>68.3± 20.6</td><td>63.1± 31.3</td><td>88.8</td><td>96.1</td><td>-0.3</td><td>95.6</td><td>109.4</td><td>109.6</td><td>110.1</td><td>6.4</td></tr><tr><td colspan="2">MuJoCo-v2 Total:</td><td>826.2 ± 33.8</td><td>785.5± 40.4</td><td>614.1</td><td>769.7</td><td>413.4</td><td>773.0</td><td>767.4</td><td>692.6*</td><td>698.5</td><td>300.8</td></tr><tr><td colspan="2">Umaze</td><td>25.0±12.0</td><td>23.8± 15.0</td><td>0.0</td><td>80.3</td><td>0.0</td><td>0.0</td><td>74.0</td><td>87.5</td><td>78.6</td><td>65.0</td></tr><tr><td colspan="2"></td><td>16.4 ± 17.9</td><td>5.6± 10.9</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>61.2</td><td>71.2</td><td>3.0</td><td>0.0</td></tr><tr><td colspan="2">Large-Play</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>15.8</td><td>39.6</td><td>0.0</td><td>0.0</td></tr><tr><td colspan="2"></td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0</td><td>57.3</td><td>0.0</td><td>0.0</td><td>84.0</td><td>62.2</td><td>71.4</td><td>55.0</td></tr><tr><td colspan="2">Medium-Diverse</td><td>23.2 ± 14.2</td><td>8.4±9.9</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>53.7</td><td>70.0</td><td>10.6</td><td>0.0</td></tr><tr><td colspan="2">Large-Diverse</td><td>2.4± 3.3</td><td>0.0±0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>14.9</td><td>47.5</td><td>0.2</td><td>0.0</td></tr><tr><td colspan="2">AntMaze-v0 Total:</td><td>67.0 ± 14.9</td><td>37.8± 12.4</td><td>0.0</td><td>137.6</td><td>0.0</td><td>0.0</td><td>303.6</td><td>378.0</td><td>163.8</td><td>120.0</td></tr></table>
Table 2: Ablation of the adversarial updates for RAMBO. These results use the same rollout length for each dataset as RAMBO but with no adversarial updates (i.e. $\lambda = 0$ ). The scores are averaged over 5 seeds.
<table><tr><td>RAMBO (No Adversarial Training)</td></tr><tr><td>MuJoCo-v2 Total: 694.4 ± 56.5|AntMaze-v0 Total: 45.8 ± 21.8</td></tr></table>
Table 3: Comparison between RAMBO and COMBO for the Single Transition Example. We use 20 seeds and $\pm$ captures the standard deviation over seeds. RAMBO outperforms COMBO $( p = 0 . 0 0 5 )$ .
<table><tr><td>RAMBO:</td><td></td></tr></table>
Ablation of Adversarial Training In Table 2 we present results for RAMBO with no adversarial updates. These results demonstrate that overall performance degrades if the adversarial training is removed. This parallels previous findings that mitigating the issue of model exploitation is crucial to obtaining strong performance in model-based offline RL. Interestingly however, for some specific datasets we obtain the best performance with no adversarial training (Appendix C.2). This suggests that a potential direction for future work could be trying to identify which types of problems do not require regularisation for a successful policy to be trained offline with model-based RL.
Comparison to COMBO We focus especially on comparing our approach to COMBO, as it is the most similar existing algorithm. We compare RAMBO and COMBO on the Single Transition toy example which is described in detail in Appendix C.1. This domain has a one-dimensional state and action space, and several distinct regions of the action space are covered by the dataset. We use this domain to investigate whether the policies optimised by RAMBO and COMBO tend to become stuck in local optima.
Table 3 compares the performance of RAMBO and COMBO on the Single Transition Example. Further analysis in Appendix C.1 shows that for this problem, the pessimistic value function updates used by COMBO create local maxima in the $Q$ -function which are present throughout training. Policy optimisation can become stuck in these local maxima. On the other hand, the value function produced by RAMBO is initially optimistic, and pessimism is introduced into the value function gradually as the transition function is modified adversarially. Adversarial modification of the transition function is visualised in Appendix C.3. As a result of this gradual introduction of pessimism, we observe that the policy produced by RAMBO is less likely to become stuck in poor local maxima, and better overall performance is obtained in Table 3. This observation may help to explain why RAMBO is able to achieve consistently strong performance relative to existing algorithms in the MuJoCo domains. Gradually increasing the level of pessimism could be a useful modification for existing offline RL algorithms to be investigated in future work.
# 7 Conclusion and Future Directions
RAMBO is a promising new approach to offline RL which imposes conservatism by adversarially modifying the transition dynamics of a learnt model. Our approach is theoretically justified, and achieves state-of-the-art performance on standard benchmarks.
There are a number of possible extensions to RAMBO, some of which we have already discussed. In addition, we would like to apply RAMBO to image-space domains by using deep latent variable models to compress the state space [18, 51] and adversarially perturbing the transition dynamics in the latent space representation. Another direction that we would like to investigate is the use of adversarially trained models to aid interpretability in deep RL [44] by generating imagined worst-case trajectories. Finally, we wish to investigate applying the ideas developed in this work to the online RL setting to improve robustness.
# Acknowledgements
This work was supported by a Programme Grant from the Engineering and Physical Sciences Research Council (EP/V000748/1), the Clarendon Fund at the University of Oxford, and a gift from Amazon Web Services. Additionally, this project made use of time on Tier 2 HPC facility JADE2, funded by the Engineering and Physical Sciences Research Council (EP/T022205/1).
The authors would like to thank Raunak Bhattacharyya, Paul Duckworth, and Matthew Budd for their feedback on an earlier draft of this work.
# References
[1] Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, pages 104–114. PMLR, 2020. [2] Gaon An, Seungyong Moon, Jang-Hyun Kim, and Hyun Oh Song. Uncertainty-based offline reinforcement learning with diversified Q-ensemble. Advances in Neural Information Processing Systems, 34:7436–7447, 2021. [3] Marcin Andrychowicz, Anton Raichuk, Piotr Stanczyk, Manu Orsini, Sertan Girgin, Raphaël ´ Marinier, Leonard Hussenot, Matthieu Geist, Olivier Pietquin, Marcin Michalski, Sylvain Gelly, and Olivier Bachem. What matters for on-policy deep actor-critic methods? A large-scale study. In International Conference on Learning Representations, 2021. [4] Arthur Argenson and Gabriel Dulac-Arnold. Model-based offline planning. In International Conference on Learning Representations, 2021. [5] J Andrew Bagnell, Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , and Jeff G Schneider. Solving uncertain Markov decision processes. Technical report, 2001. [6] Philip J Ball, Cong Lu, Jack Parker-Holder, and Stephen Roberts. Augmented world models facilitate zero-shot dynamics generalization from a single offline environment. In International Conference on Machine Learning, pages 619–629. PMLR, 2021. [7] David Brandfonbrener, Will Whitney, Rajesh Ranganath, and Joan Bruna. Offline RL without off-policy evaluation. Advances in Neural Information Processing Systems, 34:4933–4946, 2021. [8] Catherine Cang, Aravind Rajeswaran, Pieter Abbeel, and Michael Laskin. Behavioral priors and dynamics models: Improving performance and domain transfer in offline RL. In Deep RL Workshop NeurIPS 2021, 2021. [9] Ching-An Cheng, Tengyang Xie, Nan Jiang, and Alekh Agarwal. Adversarially trained actor critic for offline reinforcement learning. 2022. [10] Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. Advances in Neural Information Processing Systems, 31, 2018. [11] Ignasi Clavera, Violet Fu, and Pieter Abbeel. Model-augmented actor-critic: Backpropagating through paths. International Conference on Learning Representations, 2020. [12] Michael K Cohen and Marcus Hutter. Pessimism about unknown unknowns inspires conservatism. In Conference on Learning Theory, pages 1344–1373. PMLR, 2020. [13] Sebastian Curi, Ilija Bogunovic, and Andreas Krause. Combining pessimism with optimism for robust and efficient model-based deep reinforcement learning. In International Conference on Machine Learning, pages 2254–2264. PMLR, 2021. [14] Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4RL: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. [15] Scott Fujimoto and Shixiang Shane Gu. A minimalist approach to offline reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. [16] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pages 2052–2062. PMLR, 2019. [17] Jakob Gawlikowski, Cedrique Rovile Njieutcheu Tassi, Mohsin Ali, Jongseok Lee, Matthias Humt, Jianxiang Feng, Anna Kruspe, Rudolph Triebel, Peter Jung, Ribana Roscher, et al. A survey of uncertainty in deep neural networks. arXiv preprint arXiv:2107.03342, 2021. [18] David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. Advances in Neural Information Processing Systems, 31, 2018. [19] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, pages 1861–1870. PMLR, 2018. [20] Toru Hishinuma and Kei Senda. Weighted model estimation for offline model-based reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. [21] Garud N Iyengar. Robust dynamic programming. Mathematics of Operations Research, 30(2):257–280, 2005. [22] Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. Advances in Neural Information Processing Systems, 32, 2019. [23] Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456, 2019. [24] Kirthevasan Kandasamy, Yoram Bachrach, Ryota Tomioka, Daniel Tarlow, and David Carter. Batch policy gradient methods for improving neural conversation models. International Conference on Learning Representations, 2017. [25] Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. MOReL: Model-based offline reinforcement learning. Advances in neural information processing systems, 33:21810–21823, 2020. [26] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations, 2015. [27] Ilya Kostrikov, Rob Fergus, Jonathan Tompson, and Ofir Nachum. Offline reinforcement learning with Fisher divergence critic regularization. In International Conference on Machine Learning, pages 5774–5783. PMLR, 2021. [28] Ilya Kostrikov, Ashvin Nair, and Sergey Levine. Offline reinforcement learning with implicit Q-learning. In International Conference on Learning Representations, 2022. [29] Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing offpolicy Q-learning via bootstrapping error reduction. Advances in Neural Information Processing Systems, 32, 2019. [30] Aviral Kumar, Anikait Singh, Stephen Tian, Chelsea Finn, and Sergey Levine. A workflow for offline model-free robotic reinforcement learning. Conference on Robot Learning, 2021. [31] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative Q-learning for offline reinforcement learning. Advances in Neural Information Processing Systems, 33:1179– 1191, 2020. [32] Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. In International Conference on Learning Representations, 2018. [33] Sascha Lange, Thomas Gabel, and Martin Riedmiller. Batch reinforcement learning. In Reinforcement learning, pages 45–73. Springer, 2012. [34] Byung-Jun Lee, Jongmin Lee, and Kee-Eung Kim. Representation balancing offline modelbased reinforcement learning. In International Conference on Learning Representations, 2020. [35] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. [36] Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Off-policy policy gradient with state distribution correction. International Conference on Machine Learning RL4RealLife Workshop, 2019. [37] Cong Lu, Philip Ball, Jack Parker-Holder, Michael Osborne, and Stephen J Roberts. Revisiting design choices in offline model based reinforcement learning. In International Conference on Learning Representations, 2022. [38] Ajay Mandlekar, Fabio Ramos, Byron Boots, Silvio Savarese, Li Fei-Fei, Animesh Garg, and Dieter Fox. Iris: Implicit reinforcement without interaction at scale for learning control from offline robot manipulation data. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 4414–4420. IEEE, 2020. [39] Tatsuya Matsushima, Hiroki Furuta, Yutaka Matsuo, Ofir Nachum, and Shixiang Gu. Deployment-efficient reinforcement learning via model-based offline optimization. In International Conference on Learning Representations, 2021. [40] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. [41] Ofir Nachum, Bo Dai, Ilya Kostrikov, Yinlam Chow, Lihong Li, and Dale Schuurmans. AlgaeDICE: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074, 2019. [42] Xinkun Nie, Emma Brunskill, and Stefan Wager. Learning when-to-treat policies. Journal of the American Statistical Association, 116(533):392–409, 2021. [43] Arnab Nilim and Laurent El Ghaoui. Robust control of Markov decision processes with uncertain transition matrices. Operations Research, 53(5):780–798, 2005. [44] Michael Oberst and David Sontag. Counterfactual off-policy evaluation with gumbel-max structural causal models. In International Conference on Machine Learning, pages 4881–4890. PMLR, 2019. [45] OpenAI, Ilge Akkaya, Marcin Andrychowicz, Maciek Chociej, Mateusz Litwin, Bob McGrew, Arthur Petron, Alex Paino, Matthias Plappert, Glenn Powell, Raphael Ribas, Jonas Schneider, Nikolas Tezak, Jerry Tworek, Peter Welinder, Lilian Weng, Qiming Yuan, Wojciech Zaremba, and Lei Zhang. Solving rubik’s cube with a robot hand. arXiv preprint, 2019. [46] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? Evaluating predictive uncertainty under dataset shift. Advances in Neural Information Processing Systems, 32, 2019. [47] Tom Le Paine, Cosmin Paduraru, Andrea Michi, Caglar Gulcehre, Konrad Zolna, Alexander Novikov, Ziyu Wang, and Nando de Freitas. Hyperparameter selection for offline reinforcement learning. arXiv preprint arXiv:2007.09055, 2020. [48] Xinlei Pan, Daniel Seita, Yang Gao, and John Canny. Risk averse robust adversarial reinforcement learning. In 2019 International Conference on Robotics and Automation (ICRA), pages 8522–8528. IEEE, 2019. [49] Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019. [50] Lerrel Pinto, James Davidson, Rahul Sukthankar, and Abhinav Gupta. Robust adversarial reinforcement learning. In International Conference on Machine Learning, pages 2817–2826. PMLR, 2017. [51] Rafael Rafailov, Tianhe Yu, Aravind Rajeswaran, and Chelsea Finn. Offline reinforcement learning from images with latent space models. In Learning for Dynamics and Control, pages 1154–1168. PMLR, 2021. [52] Antonin Raffin, Ashley Hill, Adam Gleave, Anssi Kanervisto, Maximilian Ernestus, and Noah Dormann. Stable-baselines3: Reliable reinforcement learning implementations. Journal of Machine Learning Research, 2021. [53] Aravind Rajeswaran, Igor Mordatch, and Vikash Kumar. A game theoretic framework for model based reinforcement learning. In International Conference on Machine Learning, pages 7953–7963. PMLR, 2020. [54] Marc Rigter, Bruno Lacerda, and Nick Hawes. Minimax regret optimisation for robust planning in uncertain Markov decision processes. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 11930–11938. Association for the Advancement of Artificial Intelligence, 2021. [55] Aurko Roy, Huan Xu, and Sebastian Pokutta. Reinforcement learning under model mismatch. Advances in Neural Information Processing Systems, 30, 2017. [56] John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. International Conference on Learning Representations, 2016. [57] Susan M Shortreed, Eric Laber, Daniel J Lizotte, T Scott Stroup, Joelle Pineau, and Susan A Murphy. Informing sequential clinical decision-making through reinforcement learning: an empirical study. Machine learning, 84(1):109–136, 2011. [58] Noah Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavior modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020. [59] David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of Go without human knowledge. Nature, 550(7676):354–359, 2017. [60] Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM Sigart Bulletin, 2(4):160–163, 1991. [61] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. [62] Richard S Sutton, David McAllester, Satinder Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. Advances in Neural Information Processing Systems, 12, 1999. [63] Phillip Swazinna, Steffen Udluft, and Thomas Runkler. Overcoming model bias for robust offline deep reinforcement learning. Engineering Applications of Artificial Intelligence, 104:104366, 2021. [64] Aviv Tamar, Shie Mannor, and Huan Xu. Scaling up robust MDPs using function approximation. In International Conference on Machine Learning, pages 181–189. PMLR, 2014. [65] Chen Tessler, Yonathan Efroni, and Shie Mannor. Action robust reinforcement learning and applications in continuous control. In International Conference on Machine Learning, pages 6215–6224. PMLR, 2019. [66] Masatoshi Uehara and Wen Sun. Pessimistic model-based offline reinforcement learning under partial coverage. International Conference on Learning Representations, 2022. [67] Jianhao Wang, Wenzhe Li, Haozhe Jiang, Guangxiang Zhu, Siyuan Li, and Chongjie Zhang. Offline reinforcement learning with reverse model-based imagination. Advances in Neural Information Processing Systems, 34, 2021. [68] Yue Wang and Shaofeng Zou. Online robust reinforcement learning with model uncertainty. Advances in Neural Information Processing Systems, 34, 2021. [69] Paul J Werbos. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78(10):1550–1560, 1990. [70] Wolfram Wiesemann, Daniel Kuhn, and Berç Rustem. Robust Markov decision processes. Mathematics of Operations Research, 38(1):153–183, 2013. [71] Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3):229–256, 1992. [72] Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019. [73] Tengyang Xie, Ching-An Cheng, Nan Jiang, Paul Mineiro, and Alekh Agarwal. Bellmanconsistent pessimism for offline reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021. [74] Yijun Yang, Jing Jiang, Tianyi Zhou, Jie Ma, and Yuhui Shi. Pareto policy pool for model-based offline reinforcement learning. In International Conference on Learning Representations, 2021. [75] Tianhe Yu, Aviral Kumar, Rafael Rafailov, Aravind Rajeswaran, Sergey Levine, and Chelsea Finn. COMBO: Conservative offline model-based policy optimization. Advances in Neural Information Processing Systems, 34, 2021. [76] Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Y Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. MOPO: Model-based offline policy optimization. Advances in Neural Information Processing Systems, 33:14129–14142, 2020. [77] Siyuan Zhang and Nan Jiang. Towards hyperparameter-free policy selection for offline reinforcement learning. Advances in Neural Information Processing Systems, 34, 2021.
# Checklist
The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
• Did you include the license to the code and datasets? [Yes] See Section ??. • Did you include the license to the code and datasets? [No] The code and the data are proprietary. • Did you include the license to the code and datasets? [N/A]
Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
1. For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] (b) Did you describe the limitations of your work? [Yes] We included results for the AntMaze datasets where our approach performs less well than model-free methods. (c) Did you discuss any potential negative societal impacts of your work? [N/A] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
2. If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] We include a complete proof of Proposition 2. For the theoretical results from [66], we provide references to the appropriate parts of that paper.
3. If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] A URL to the code is provided. (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Detailed information about implementation details and hyperparameters is in the appendix. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Standard deviation with respect to seeds is reported for all results. (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Details of compute used per run and total compute used for full evaluation is in Appendix B.8.
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators? [Yes] We cite the D4RL benchmark datasets [14]. (b) Did you mention the license of the assets? [Yes] In Appendix B.7. (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code for our work is in included via a URL. (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
5. If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241# Per-Pixel Classification is Not All You Need for Semantic Segmentation
Bowen Cheng1,2∗ Alexander G. Schwing2 Alexander Kirillov1
1Facebook AI Research (FAIR)
2University of Illinois at Urbana-Champaign (UIUC)
# Abstract
Modern approaches typically formulate semantic segmentation as a per-pixel classification task, while instance-level segmentation is handled with an alternative mask classification. Our key insight: mask classification is sufficiently general to solve both semantic- and instance-level segmentation tasks in a unified manner using the exact same model, loss, and training procedure. Following this observation, we propose MaskFormer, a simple mask classification model which predicts a set of binary masks, each associated with a single global class label prediction. Overall, the proposed mask classification-based method simplifies the landscape of effective approaches to semantic and panoptic segmentation tasks and shows excellent empirical results. In particular, we observe that MaskFormer outperforms per-pixel classification baselines when the number of classes is large. Our mask classification-based method outperforms both current state-of-the-art semantic (55.6 mIoU on ADE20K) and panoptic segmentation (52.7 PQ on COCO) models.1
# 1 Introduction
The goal of semantic segmentation is to partition an image into regions with different semantic categories. Starting from Fully Convolutional Networks (FCNs) work of Long et al. [28], most deep learning-based semantic segmentation approaches formulate semantic segmentation as per-pixel classification (Figure 1 left), applying a classification loss to each output pixel [8, 46]. Per-pixel predictions in this formulation naturally partition an image into regions of different classes.
Mask classification is an alternative paradigm that disentangles the image partitioning and classification aspects of segmentation. Instead of classifying each pixel, mask classification-based methods predict a set of binary masks, each associated with a single class prediction (Figure 1 right). The more flexible mask classification dominates the field of instance-level segmentation. Both Mask R-CNN [19] and DETR [3] yield a single class prediction per segment for instance and panoptic segmentation. In contrast, per-pixel classification assumes a static number of outputs and cannot return a variable number of predicted regions/segments, which is required for instance-level tasks.
Our key observation: mask classification is sufficiently general to solve both semantic- and instancelevel segmentation tasks. In fact, before FCN [28], the best performing semantic segmentation methods like O2P [4] and SDS [18] used a mask classification formulation. Given this perspective, a natural question emerges: can a single mask classification model simplify the landscape of effective approaches to semantic- and instance-level segmentation tasks? And can such a mask classification model outperform existing per-pixel classification methods for semantic segmentation?
To address both questions we propose a simple MaskFormer approach that seamlessly converts any existing per-pixel classification model into a mask classification. Using the set prediction mechanism proposed in DETR [3], MaskFormer employs a Transformer decoder [37] to compute a set of pairs, each consisting of a class prediction and a mask embedding vector. The mask embedding vector is used to get the binary mask prediction via a dot product with the per-pixel embedding obtained from an underlying fully-convolutional network. The new model solves both semantic- and instance-level segmentation tasks in a unified manner: no changes to the model, losses, and training procedure are required. Specifically, for semantic and panoptic segmentation tasks alike, MaskFormer is supervised with the same per-pixel binary mask loss and a single classification loss per mask. Finally, we design a simple inference strategy to blend MaskFormer outputs into a task-dependent prediction format.
 Figure 1: Per-pixel classification vs. mask classification. (left) Semantic segmentation with perpixel classification applies the same classification loss to each location. (right) Mask classification predicts a set of binary masks and assigns a single class to each mask. Each prediction is supervised with a per-pixel binary mask loss and a classification loss. Matching between the set of predictions and ground truth segments can be done either via bipartite matching similarly to DETR [3] or by fixed matching via direct indexing if the number of predictions and classes match, i.e., if $N = K$ .
We evaluate MaskFormer on five semantic segmentation datasets with various numbers of categories: Cityscapes [13] (19 classes), Mapillary Vistas [31] (65 classes), ADE20K [49] (150 classes), COCOStuff-10K [2] (171 classes), and ADE20K-Full [49] (847 classes). While MaskFormer performs on par with per-pixel classification models for Cityscapes, which has a few diverse classes, the new model demonstrates superior performance for datasets with larger vocabulary. We hypothesize that a single class prediction per mask models fine-grained recognition better than per-pixel class predictions. MaskFormer achieves the new state-of-the-art on ADE20K $\mathbf { \left( 5 5 . 6 \ m I o U \right) }$ ) with Swin-Transformer [27] backbone, outperforming a per-pixel classification model [27] with the same backbone by 2.1 mIoU, while being more efficient ( $10 \%$ reduction in parameters and $40 \%$ reduction in FLOPs).
Finally, we study MaskFormer’s ability to solve instance-level tasks using two panoptic segmentation datasets: COCO [26, 22] and ADE20K [49]. MaskFormer outperforms a more complex DETR model [3] with the same backbone and the same post-processing. Moreover, MaskFormer achieves the new state-of-the-art on COCO (52.7 PQ), outperforming prior state-of-the-art [38] by 1.6 PQ. Our experiments highlight MaskFormer’s ability to unify instance- and semantic-level segmentation.
# 2 Related Works
Both per-pixel classification and mask classification have been extensively studied for semantic segmentation. In early work, Konishi and Yuille [23] apply per-pixel Bayesian classifiers based on local image statistics. Then, inspired by early works on non-semantic groupings [11, 33], mask classification-based methods became popular demonstrating the best performance in PASCAL VOC challenges [16]. Methods like O2P [4] and CFM [14] have achieved state-of-the-art results by classifying mask proposals [5, 36, 1]. In 2015, FCN [28] extended the idea of per-pixel classification to deep nets, significantly outperforming all prior methods on mIoU (a per-pixel evaluation metric which particularly suits the per-pixel classification formulation of segmentation).
Per-pixel classification became the dominant way for deep-net-based semantic segmentation since the seminal work of Fully Convolutional Networks (FCNs) [28]. Modern semantic segmentation models focus on aggregating long-range context in the final feature map: ASPP [6, 7] uses atrous convolutions with different atrous rates; PPM [46] uses pooling operators with different kernel sizes; DANet [17], OCNet [45], and CCNet [21] use different variants of non-local blocks [39]. Recently, SETR [47] and Segmenter [34] replace traditional convolutional backbones with Vision Transformers (ViT) [15] that capture long-range context starting from the very first layer. However, these concurrent Transformer-based [37] semantic segmentation approaches still use a per-pixel classification formulation. Note, that our MaskFormer module can convert any per-pixel classification model to the mask classification setting, allowing seamless adoption of advances in per-pixel classification.
Mask classification is commonly used for instance-level segmentation tasks [18, 22]. These tasks require a dynamic number of predictions, making application of per-pixel classification challenging as it assumes a static number of outputs. Omnipresent Mask R-CNN [19] uses a global classifier to classify mask proposals for instance segmentation. DETR [3] further incorporates a Transformer [37] design to handle thing and stuff segmentation simultaneously for panoptic segmentation [22]. However, these mask classification methods require predictions of bounding boxes, which may limit their usage in semantic segmentation. The recently proposed Max-DeepLab [38] removes the dependence on box predictions for panoptic segmentation with conditional convolutions [35, 40]. However, in addition to the main mask classification losses it requires multiple auxiliary losses (i.e., instance discrimination loss, mask-ID cross entropy loss, and the standard per-pixel classification loss).
# 3 From Per-Pixel to Mask Classification
In this section, we first describe how semantic segmentation can be formulated as either a per-pixel classification or a mask classification problem. Then, we introduce our instantiation of the mask classification model with the help of a Transformer decoder [37]. Finally, we describe simple inference strategies to transform mask classification outputs into task-dependent prediction formats.
# 3.1 Per-pixel classification formulation
For per-pixel classification, a segmentation model aims to predict the probability distribution over all possible K categories for every pixel of an H×W image: y = {pi|pi ∈ ∆K }H·Wi=1 . Here ∆K is the Kdimensional probability simplex. Training a per-pixel classification model is straight-forward: given ground truth category labels $y ^ { \mathrm { g t } } = \{ y _ { i } ^ { \mathrm { g t } } | y _ { i } ^ { \mathrm { g t } } \in \{ 1 , \dots , K \} \} _ { i = 1 } ^ { H \cdot W }$ for every pixel, a per-pixel crossentropy (negative log-likelihood) loss is usually applied, i.e., $\begin{array} { r } { \dot { \mathcal { L } } _ { \mathrm { p i x e l - c l s } } ( y , y ^ { \mathrm { g t } } ) = \sum _ { i = 1 } ^ { H \cdot W } - \log p _ { i } ( y _ { i } ^ { \mathrm { g t } } ) } \end{array}$ .
# 3.2 Mask classification formulation
Mask classification splits the segmentation task into 1) partitioning/grouping the image into $N$ regions $N$ does not need to equal $K$ ), represented with binary masks $\{ m _ { i } | \bar { m } _ { i } \in [ 0 , 1 ] ^ { \bar { H } \times W } \} _ { i = 1 } ^ { N }$ }Ni=1; and 2) associating each region as a whole with some distribution over $K$ categories. To jointly group and classify a segment, i.e., to perform mask classification, we define the desired output $z$ as a set of $N$ probability-mask pairs, i.e., $z = \{ ( p _ { i } , m _ { i } ) \} _ { i = 1 } ^ { N }$ . In contrast to per-pixel class probability prediction, for mask classification the probability distribution $p _ { i } \in \Delta ^ { K + 1 }$ contains an auxiliary “no object” label $( \emptyset )$ in addition to the $K$ category labels. The $\mathcal { D }$ label is predicted for masks that do not correspond to any of the $K$ categories. Note, mask classification allows multiple mask predictions with the same associated class, making it applicable to both semantic- and instance-level segmentation tasks.
To train a mask classification model, a matching $\sigma$ between the set of predictions $z$ and the set of $N ^ { \mathrm { g t } }$ ground truth segments zgt = {(cgti , mgti )|cgti ∈ {1, . . . , K }, mgti ∈ {0, 1}H×W }N gti=1 i s required.2 Here $c _ { i } ^ { \mathrm { g t } }$ is the ground truth class of the $i ^ { \mathrm { { t h } } }$ ground truth segment. Since the size of prediction set $| z | = N$ and ground truth set $| z ^ { \mathrm { g t } } | = N ^ { \mathrm { g t } }$ generally differ, we assume $N \geq N ^ { \mathrm { g t } }$ and pad the set of ground truth labels with “no object” tokens $\mathcal { D }$ to allow one-to-one matching.
For semantic segmentation, a trivial fixed matching is possible if the number of predictions $N$ matches the number of category labels $K$ . In this case, the $i ^ { \mathrm { { t h } } }$ prediction is matched to a ground truth region with class label $i$ and to $\mathcal { D }$ if a region with class label $i$ is not present in the ground truth. In our experiments, we found that a bipartite matching-based assignment demonstrates better results than the fixed matching. Unlike DETR [3] that uses bounding boxes to compute the assignment costs between prediction $z _ { i }$ and ground truth $z _ { j } ^ { \mathrm { g t } }$ for the matching problem, we directly use class and mask predictions, i.e., $- p _ { i } ( c _ { j } ^ { \mathrm { g t } } ) + \mathcal { L } _ { \mathrm { m a s k } } ( m _ { i } , m _ { j } ^ { \mathrm { g t } } )$ , where ${ \mathcal { L } } _ { \mathrm { m a s k } }$ is a binary mask loss.
To train model parameters, given a matching, the main mask classification loss $\mathcal { L } _ { \mathrm { m a s k - c l s } }$ is composed of a cross-entropy classification loss and a binary mask loss $\mathcal { L } _ { \mathrm { m a s k } }$ for each predicted segment:
$$\begin{array} { r } { \mathcal { L } _ { \mathrm { m a s k - c l s } } ( z , z ^ { \mathsf { g t } } ) = \sum _ { j = 1 } ^ { N } \left[ - \log p _ { \sigma ( j ) } ( c _ { j } ^ { \mathsf { g t } } ) + \mathbb { 1 } _ { c _ { j } ^ { \mathsf { g t } } \neq \sigma } \mathcal { L } _ { \mathrm { m a s k } } ( m _ { \sigma ( j ) } , m _ { j } ^ { \mathsf { g t } } ) \right] . } \end{array}$$
 Figure 2: MaskFormer overview. We use a backbone to extract image features $\mathcal { F }$ . A pixel decoder gradually upsamples image features to extract per-pixel embeddings $\mathcal { E } _ { \mathrm { p i x e l } }$ . A transformer decoder attends to image features and produces $N$ per-segment embeddings $\mathcal { Q }$ . The embeddings independently generate $N$ class predictions with $N$ corresponding mask embeddings ${ \mathcal { E } } _ { \mathrm { m a s k } }$ . Then, the model predicts $N$ possibly overlapping binary mask predictions via a dot product between pixel embeddings $\mathcal { E } _ { \mathrm { p i x e l } }$ and mask embeddings ${ \mathcal { E } } _ { \mathrm { m a s k } }$ followed by a sigmoid activation. For semantic segmentation task we can get the final prediction by combining $N$ binary masks with their class predictions using a simple matrix multiplication (see Section 3.4). Note, the dimensions for multiplication $\otimes$ are shown in gray.
Note, that most existing mask classification models use auxiliary losses (e.g., a bounding box loss [19, 3] or an instance discrimination loss [38]) in addition to $\mathcal { L } _ { \mathrm { m a s k - c l s } }$ . In the next section we present a simple mask classification model that allows end-to-end training with $\mathcal { L } _ { \mathrm { m a s k - c l s } }$ alone.
# 3.3 MaskFormer
We now introduce MaskFormer, the new mask classification model, which computes $N$ probabilitymask pairs $z = \{ ( p _ { i } , m _ { i } ) \} _ { i = 1 } ^ { N }$ . The model contains three modules (see Fig. 2): 1) a pixel-level module that extracts per-pixel embeddings used to generate binary mask predictions; 2) a transformer module, where a stack of Transformer decoder layers [37] computes $N$ per-segment embeddings; and 3) a segmentation module, which generates predictions $\{ ( p _ { i } , m _ { i } ) \} _ { i = 1 } ^ { N ^ { \ast } }$ from these embeddings. During inference, discussed in Sec. 3.4, $p _ { i }$ and $m _ { i }$ are assembled into the final prediction.
Pixel-level module takes an image of size $H \times W$ as input. A backbone generates a (typically) low-resolution image feature map $\mathcal { F } \in \mathbb { R } ^ { C _ { \mathcal { F } } \times \frac { H } { S } \times \frac { W } { S } }$ , where $C _ { \mathcal { F } }$ is the number of channels and $S$ is the stride of the feature map ( $C _ { \mathcal { F } }$ depends on the specific backbone and we use $S = 3 2$ in this work). Then, a pixel decoder gradually upsamples the features to generate per-pixel embeddings $\mathcal { E } _ { \mathrm { p i x e l } } \in \mathbb { R } ^ { C _ { \varepsilon } \times H \stackrel { \cdot } { \times } W }$ , where $C _ { \mathcal { E } }$ is the embedding dimension. Note, that any per-pixel classificationbased segmentation model fits the pixel-level module design including recent Transformer-based models [34, 47, 27]. MaskFormer seamlessly converts such a model to mask classification.
Transformer module uses the standard Transformer decoder [37] to compute from image features $\mathcal { F }$ and $N$ learnable positional embeddings (i.e., queries) its output, i.e., $N$ per-segment embeddings $\mathcal { Q } \in \mathbb { R } ^ { C _ { \mathcal { Q } } \times N }$ of dimension $C _ { \mathcal { Q } }$ that encode global information about each segment MaskFormer predicts. Similarly to [3], the decoder yields all predictions in parallel.
Segmentation module applies a linear classifier, followed by a softmax activation, on top of the per-segment embeddings Note, that the classifier p $\mathcal { Q }$ to yield class probability predictions dicts an additional “no object” categ $\{ p _ { i } \in \Delta ^ { K + 1 } \} _ { i = 1 } ^ { N }$ for each segment. embedding does $( \emptyset )$ not correspond to any region. For mask prediction, a Multi-Layer Perceptron (MLP) with 2 hidden layers converts the per-segment embeddings $\mathcal { Q }$ to $N$ mask embeddings $\bar { \mathcal { E } _ { \mathrm { m a s k } } } \in \mathbb { R } ^ { C \varepsilon \times N }$ of dimension $C _ { \mathcal { E } }$ . Finally, we obtain each binary mask prediction $m _ { i } \in [ 0 , 1 ] ^ { H \times \widecheck W }$ via a dot product between the $i ^ { \mathrm { { t h } } }$ mask embedding and per-pixel embeddings $\mathcal { E } _ { \mathrm { p i x e l } }$ computed by the pixel-level module. The dot product is followed by a sigmoid activation, i.e., $\begin{array} { r } { \dot { m } _ { i } [ h , w ] = \mathrm { s i g m o i d } ( \mathcal { E } _ { \mathrm { m a s k } } [ : , i ] ^ { \mathrm { T } } \cdot \mathcal { E } _ { \mathrm { p i x e l } } [ : , h , w ] ) } \end{array}$ .
Note, we empirically find it is beneficial to not enforce mask predictions to be mutually exclusive to each other by using a softmax activation. During training, the $\mathcal { L } _ { \mathrm { m a s k - c l s } }$ loss combines a cross entropy classification loss and a binary mask loss $\mathcal { L } _ { \mathrm { m a s k } }$ for each predicted segment. For simplicity we use the same $\mathcal { L } _ { \mathrm { m a s k } }$ as DETR [3], i.e., a linear combination of a focal loss [25] and a dice loss [30] multiplied by hyper-parameters $\lambda _ { \mathrm { f o c a l } }$ and $\lambda _ { \mathrm { d i c e } }$ respectively.
# 3.4 Mask-classification inference
First, we present a simple general inference procedure that converts mask classification outputs $\{ ( p _ { i } , m _ { i } ) \bar \} _ { i = 1 } ^ { N }$ to either panoptic or semantic segmentation output formats. Then, we describe a semantic inference procedure specifically designed for semantic segmentation. We note, that the specific choice of inference strategy largely depends on the evaluation metric rather than the task.
General inference partitions an image into segments by assigning each pixel $[ h , w ]$ to one of the $N$ predicted probability-mask pairs via arg $\mathrm { m a x } _ { i : c _ { i } \neq \emptyset } p _ { i } ( c _ { i } ) \cdot m _ { i } [ h , w ]$ . Here $c _ { i }$ is the most likely class label $c _ { i } = \arg \operatorname* { m a x } _ { c \in \{ 1 , \ldots , K , \infty \} } p _ { i } ( c )$ for each probability-mask pair $i$ . Intuitively, this procedure assigns a pixel at location $[ h , w ]$ to probability-mask pair $i$ only if both the most likely class probability $p _ { i } ( c _ { i } )$ and the mask prediction probability $m _ { i } [ h , w ]$ are high. Pixels assigned to the same probabilitymask pair $i$ form a segment where each pixel is labelled with $c _ { i }$ . For semantic segmentation, segments sharing the same category label are merged; whereas for instance-level segmentation tasks, the index $i$ of the probability-mask pair helps to distinguish different instances of the same class. Finally, to reduce false positive rates in panoptic segmentation we follow previous inference strategies [3, 22]. Specifically, we filter out low-confidence predictions prior to inference and remove predicted segments that have large parts of their binary masks $( m _ { i } > 0 . 5 )$ occluded by other predictions.
Semantic inference is designed specifically for semantic segmentation and is done via a simple matrix multiplication. We empirically find that marginalization over probability-mask pairs, i.e., arg $\begin{array} { r } { \operatorname* { m a x } _ { c \in \{ 1 , \ldots , K \} } \sum _ { i = 1 } ^ { N } p _ { i } ( c ) \cdot m _ { i } [ h , w ] } \end{array}$ , yields better results than the hard assignment of each pixel to a probability-mask pair $i$ used in the general inference strategy. The argmax does not include the “no object” category $( \emptyset )$ as standard semantic segmentation requires each output pixel to take a label. Note, this strategy returns a per-pixel class probability $\begin{array} { r } { \sum _ { i = 1 } ^ { N } p _ { i } ( c ) \cdot m _ { i } [ h , w ] } \end{array}$ . However, we observe that directly maximizing per-pixel class likelihood leads to poor performance. We hypothesize, that gradients are evenly distributed to every query, which complicates training.
# 4 Experiments
We demonstrate that MaskFormer seamlessly unifies semantic- and instance-level segmentation tasks by showing state-of-the-art results on both semantic segmentation and panoptic segmentation datasets. Then, we ablate the MaskFormer design confirming that observed improvements in semantic segmentation indeed stem from the shift from per-pixel classification to mask classification.
Datasets. We study MaskFormer using four widely used semantic segmentation datasets: ADE20K [49] (150 classes) from the SceneParse150 challenge [48], COCO-Stuff-10K [2] (171 classes), Cityscapes [13] (19 classes), and Mapillary Vistas [31] (65 classes). In addition, we use the ADE20K-Full [49] dataset annotated in an open vocabulary setting (we keep 874 classes that are present in both train and validation sets). For panotic segmenation evaluation we use COCO [26, 2, 22] (80 “things” and 53 “stuff” categories) and ADE20K-Panoptic [49, 22] (100 “things” and 50 “stuff” categories). Please see the appendix for detailed descriptions of all used datasets.
Evaluation metrics. For semantic segmentation the standard metric is mIoU (mean Intersection-overUnion) [16], a per-pixel metric that directly corresponds to the per-pixel classification formulation. To better illustrate the difference between segmentation approaches, in our ablations we supplement mIoU with $\mathbf { P Q } ^ { \mathbf { S t } }$ (PQ stuff) [22], a per-region metric that treats all classes as “stuff” and evaluates each segment equally, irrespective of its size. We report the median of 3 runs for all datasets, except for Cityscapes where we report the median of 5 runs. For panoptic segmentation, we use the standard PQ (panoptic quality) metric [22] and report single run results due to prohibitive training costs.
Baseline models. On the right we sketch the used per-pixel classification baselines. The PerPixelBaseline uses the pixel-level module of MaskFormer and directly outputs per-pixel class scores. For a fair comparison, we design PerPixelBaseline+ which adds the transformer module and mask em

bedding MLP to the PerPixelBaseline. Thus, PerPixelBaseline+ and MaskFormer differ only in the formulation: per-pixel vs. mask classification. Note that these baselines are for ablation and we compare MaskFormer with state-of-the-art per-pixel classification models as well.
# 4.1 Implementation details
Backbone. MaskFormer is compatible with any backbone architecture. In our work we use the standard convolution-based ResNet [20] backbones (R50 and R101 with 50 and 101 layers respectively) and recently proposed Transformer-based Swin-Transformer [27] backbones. In addition, we use the R101c model [6] which replaces the first $7 \times 7$ convolution layer of R101 with 3 consecutive $3 \times 3$ convolutions and which is popular in the semantic segmentation community [46, 7, 8, 21, 44, 10].
Pixel decoder. The pixel decoder in Figure 2 can be implemented using any semantic segmentation decoder (e.g., [8–10]). Many per-pixel classification methods use modules like ASPP [6] or PSP [46] to collect and distribute context across locations. The Transformer module attends to all image features, collecting global information to generate class predictions. This setup reduces the need of the per-pixel module for heavy context aggregation. Therefore, for MaskFormer, we design a light-weight pixel decoder based on the popular FPN [24] architecture.
Following FPN, we $2 \times$ upsample the low-resolution feature map in the decoder and sum it with the projected feature map of corresponding resolution from the backbone; Projection is done to match channel dimensions of the feature maps with a $1 \times 1$ convolution layer followed by GroupNorm (GN) [41]. Next, we fuse the summed features with an additional $3 \times 3$ convolution layer followed by GN and ReLU activation. We repeat this process starting with the stride 32 feature map until we obtain a final feature map of stride 4. Finally, we apply a single $1 \times 1$ convolution layer to get the per-pixel embeddings. All feature maps in the pixel decoder have a dimension of 256 channels.
Transformer decoder. We use the same Transformer decoder design as DETR [3]. The $N$ query embeddings are initialized as zero vectors, and we associate each query with a learnable positional encoding. We use 6 Transformer decoder layers with 100 queries by default, and, following DETR, we apply the same loss after each decoder. In our experiments we observe that MaskFormer is competitive for semantic segmentation with a single decoder layer too, whereas for instance-level segmentation multiple layers are necessary to remove duplicates from the final predictions.
Segmentation module. The multi-layer perceptron (MLP) in Figure 2 has 2 hidden layers of 256 channels to predict the mask embeddings $\mathcal { E } _ { \mathrm { m a s k } }$ , analogously to the box head in DETR. Both per-pixel $\mathcal { E } _ { \mathrm { p i x e l } }$ and mask ${ \mathcal { E } } _ { \mathrm { m a s k } }$ embeddings have 256 channels.
Loss weights. We use focal loss [25] and dice loss [30] for our mask loss: ${ \mathcal { L } } _ { \mathrm { m a s k } } ( m , m ^ { \mathrm { g t } } ) =$ $\lambda _ { \mathrm { f o c a l } } \mathcal { L } _ { \mathrm { f o c a l } } ( m , m ^ { \mathrm { g t } } ) + \lambda _ { \mathrm { d i c e } } \mathcal { L } _ { \mathrm { d i c e } } ( m , m ^ { \mathrm { g t } } )$ , and set the hyper-parameters to $\lambda _ { \mathrm { f o c a l } } = 2 0 . 0$ and $\lambda _ { \mathrm { d i c e } } =$ 1.0. Following DETR [3], the weight for the “no object” $( \emptyset )$ in the classification loss is set to 0.1.
# 4.2 Training settings
Semantic segmentation. We use Detectron2 [42] and follow the commonly used training settings for each dataset. More specifically, we use AdamW [29] and the poly [6] learning rate schedule with an initial learning rate of $1 0 ^ { - \bar { 4 } }$ and a weight decay of $1 0 ^ { - 4 }$ for ResNet [20] backbones, and an initial learning rate of $6 \cdot 1 0 ^ { - 5 }$ and a weight decay of $1 0 ^ { - 2 }$ for Swin-Transformer [27] backbones. Backbones are pre-trained on ImageNet-1K [32] if not stated otherwise. A learning rate multiplier of 0.1 is applied to CNN backbones and 1.0 is applied to Transformer backbones. The standard random scale jittering between 0.5 and 2.0, random horizontal flipping, random cropping as well as random color jittering are used as data augmentation [12]. For the ADE20K dataset, if not stated otherwise, we use a crop size of $5 1 2 \times 5 1 2$ , a batch size of 16 and train all models for $1 6 0 \mathrm { k }$ iterations. For the ADE20K-Full dataset, we use the same setting as ADE20K except that we train all models for $2 0 0 \mathrm { k }$ iterations. For the COCO-Stuff-10k dataset, we use a crop size of $6 4 0 \times 6 4 0$ , a batch size of 32 and train all models for $6 0 \mathrm { k }$ iterations. All models are trained with 8 V100 GPUs. We report both performance of single scale (s.s.) inference and multi-scale (m.s.) inference with horizontal flip and scales of 0.5, 0.75, 1.0, 1.25, 1.5, 1.75. See appendix for Cityscapes and Mapillary Vistas settings.
Panoptic segmentation. We follow exactly the same architecture, loss, and training procedure as we use for semantic segmentation. The only difference is supervision: i.e., category region masks in semantic segmentation vs. object instance masks in panoptic segmentation. We strictly follow the DETR [3] setting to train our model on the COCO panoptic segmentation dataset [22] for a fair comparison. On the ADE20K panoptic segmentation dataset, we follow the semantic segmentation setting but train for longer (720k iterations) and use a larger crop size $6 4 0 \times 6 4 0 )$ ). COCO models are trained using 64 V100 GPUs and ADE20K experiments are trained with 8 V100 GPUs. We use the general inference (Section 3.4) with the following parameters: we filter out masks with class confidence below 0.8 and set masks whose contribution to the final panoptic segmentation is less than $80 \%$ of its mask area to VOID. We report performance of single scale inference.
Table 1: Semantic segmentation on ADE20K val with 150 categories. Mask classification-based MaskFormer outperforms the best per-pixel classification approaches while using fewer parameters and less computation. We report both single-scale (s.s.) and multi-scale (m.s.) inference results with ±std. FLOPs are computed for the given crop size. Frames-per-second (fps) is measured on a V100 GPU with a batch size of 1.3 Backbones pre-trained on ImageNet-22K are marked with †.
<table><tr><td></td><td>method</td><td>backbone</td><td>crop size</td><td>mIoU (s.s.)</td><td>mloU (m.s.)</td><td>#params.</td><td>FLOPs</td><td>fps</td></tr><tr><td rowspan="5">GN egeess</td><td rowspan="2">OCRNet [44]</td><td>R101c</td><td>520×520</td><td>1</td><td>45.3</td><td>-</td><td>-</td><td>-</td></tr><tr><td>R50c</td><td>512×512</td><td>44.0</td><td>44.9</td><td>44M</td><td>177G</td><td>21.0</td></tr><tr><td rowspan="2">DeepLabV3+ [8]</td><td>R101c</td><td>512×512</td><td>45.5</td><td>46.4</td><td>63M</td><td>255G</td><td>14.2</td></tr><tr><td>R50</td><td>512×512</td><td>44.5 ±0.5</td><td>46.7 ±0.6</td><td>41M</td><td>53G</td><td>24.5</td></tr><tr><td rowspan="2">MaskFormer (ours)</td><td>R101</td><td>512 × 512</td><td>45.5 ±0.5</td><td>47.2 ±0.2</td><td>60M</td><td>73G</td><td>19.5</td></tr><tr><td>R101c</td><td>512 × 512</td><td>46.0 ±0.1</td><td>48.1 ±0.2</td><td>60M</td><td>80G</td><td>19.0</td></tr><tr><td rowspan="10">Trrirrrrrgrreloreors</td><td>SETR[47]</td><td>ViT-L</td><td>512×512</td><td>-</td><td>50.3</td><td>308M</td><td>-</td><td>-</td></tr><tr><td rowspan="4">Swin-UperNet [27,43]</td><td>Swin-T</td><td>512×512</td><td>1</td><td>46.1</td><td>60M</td><td>236G</td><td>18.5</td></tr><tr><td>Swin-S</td><td>512× 512</td><td>1</td><td>49.3</td><td>81M</td><td>259G</td><td>15.2</td></tr><tr><td>Swin-B</td><td>640 × 640</td><td>1</td><td>51.6</td><td>121M</td><td>471G</td><td>8.7</td></tr><tr><td>Swin-L</td><td>640× 640</td><td>-</td><td>53.5</td><td>234M</td><td>647G</td><td>6.2</td></tr><tr><td rowspan="5">MaskFormer (ours)</td><td>Swin-T</td><td>512×512</td><td>46.7 ±0.7</td><td>48.8 ±0.6</td><td>42M</td><td>55G</td><td>22.1</td></tr><tr><td>Swin-S</td><td>512× 512</td><td>49.8 ±0.4</td><td>51.0 ±0.4</td><td>63M</td><td>79G</td><td>19.6</td></tr><tr><td>Swin-B</td><td>640× 640</td><td>51.1 ±0.2</td><td>52.3 ±0.4</td><td>102M</td><td>195G</td><td>12.6</td></tr><tr><td>Swin-B</td><td>640×640</td><td>52.7 ±0.4</td><td>53.9 ±0.2</td><td>102M</td><td>195G</td><td>12.6</td></tr><tr><td>Swin-L†</td><td>640 × 640</td><td>54.1 ±0.2</td><td>55.6 ±0.1</td><td>212M</td><td>375G</td><td>7.9</td></tr></table>
Table 2: MaskFormer vs. per-pixel classification baselines on 4 semantic segmentation datasets. MaskFormer improvement is larger when the number of classes is larger. We use a ResNet-50 backbone and report single scale mIoU and $\mathrm { P Q } ^ { \mathrm { S t } }$ for ADE20K, COCO-Stuff and ADE20K-Full, whereas for higher-resolution Cityscapes we use a deeper ResNet-101 backbone following [7, 8].
<table><tr><td></td><td>Cityscapes (19 classes) mIoU</td><td>PQS</td><td>ADE20K(150 classes) mIoU</td><td>PQS</td><td>COCO-Stuff (171 classes) mIoU</td><td>PQSt</td><td>ADE20K-Full(847 classes) mIoU</td><td>PQSt</td></tr><tr><td>PerPixelBaseline</td><td>77.4</td><td>58.9</td><td>39.2</td><td>21.6</td><td>32.4</td><td>15.5</td><td>12.4</td><td>5.8</td></tr><tr><td>PerPixelBaseline+</td><td>78.5</td><td>60.2</td><td>41.9</td><td>28.3</td><td>34.2</td><td>24.6</td><td>13.9</td><td>9.0</td></tr><tr><td>MaskFormer(ours)</td><td>78.5(+0.0)</td><td>63.1 (+2.9)</td><td>44.5 (+2.6)</td><td>33.4 (+5.1)</td><td>37.1 (+2.9)</td><td>28.9 (+4.3)</td><td>17.4 (+3.5)</td><td>11.9 (+2.9)</td></tr></table>
# 4.3 Main results
Semantic segmentation. In Table 1, we compare MaskFormer with state-of-the-art per-pixel classification models for semantic segmentation on the ADE20K val set. With the same standard CNN backbones (e.g., ResNet [20]), MaskFormer outperforms DeepLab ${ \mathrm { V } } 3 +$ [8] by 1.7 mIoU. MaskFormer is also compatible with recent Vision Transformer [15] backbones (e.g., the Swin Transformer [27]), achieving a new state-of-the-art of $5 5 . 6 \mathrm { m I o U }$ , which is 2.1 mIoU better than the prior state-of-theart [27]. Observe that MaskFormer outperforms the best per-pixel classification-based models while having fewer parameters and faster inference time. This result suggests that the mask classification formulation has significant potential for semantic segmentation. See appendix for results on test set.
Beyond ADE20K, we further compare MaskFormer with our baselines on COCO-Stuff-10K, ADE20K-Full as well as Cityscapes in Table 2 and we refer to the appendix for comparison with state-of-the-art methods on these datasets. The improvement of MaskFormer over PerPixelBaseline $^ +$ is larger when the number of classes is larger: For Cityscapes, which has only 19 categories, MaskFormer performs similarly well as PerPixelBaseline $^ +$ ; While for ADE20K-Full, which has 847 classes, MaskFormer outperforms PerPixelBaseline $^ +$ by 3.5 mIoU.
Although MaskFormer shows no improvement in mIoU for Cityscapes, the $\mathrm { P Q } ^ { \mathrm { S t } }$ metric increases by $2 . 9 \mathrm { \bar { P Q } ^ { S t } }$ . We find MaskFormer performs better in terms of recognition quality $( \mathsf { R Q } ^ { \mathsf { S t } } )$ while lagging in per-pixel segmentation quality $( \mathrm { S Q } ^ { \mathrm { S t } } )$ (we refer to the appendix for detailed numbers). This observation suggests that on datasets where class recognition is relatively easy to solve, the main challenge for mask classification-based approaches is pixel-level accuracy (i.e., mask quality).
Table 3: Panoptic segmentation on COCO panoptic val with 133 categories. MaskFormer seamlessly unifies semantic- and instance-level segmentation without modifying the model architecture or loss. Our model, which achieves better results, can be regarded as a box-free simplification of DETR [3]. The major improvement comes from “stuff” classes $( \mathrm { P Q } ^ { \mathrm { S t } } )$ which are ambiguous to represent with bounding boxes. For MaskFormer (DETR) we use the exact same post-processing as DETR. Note, that in this setting MaskFormer performance is still better than DETR $( + 2 . 2 \ : \mathrm { P Q } )$ . Our model also outperforms recently proposed Max-DeepLab [38] without the need of sophisticated auxiliary losses, while being more efficient. FLOPs are computed as the average FLOPs over 100 validation images (COCO images have varying sizes). Frames-per-second (fps) is measured on a V100 GPU with a batch size of 1 by taking the average runtime on the entire val set including post-processing time. Backbones pre-trained on ImageNet-22K are marked with †.
<table><tr><td></td><td>method</td><td>backbone</td><td>PQ</td><td>PQTh</td><td>PQSt</td><td>SQ</td><td>RQ</td><td>#params.</td><td>FLOPs</td><td>fps</td></tr><tr><td></td><td>DETR [3]</td><td>R50+6Enc</td><td>43.4</td><td>48.2</td><td>36.3</td><td>79.3</td><td>53.8</td><td>-</td><td>-</td><td>-</td></tr><tr><td></td><td>MaskFormer (DETR)</td><td>R50 +6Enc</td><td>45.6</td><td>50.0 (+1.8)</td><td>39.0 (+2.7)</td><td>80.2</td><td>55.8</td><td>-</td><td>-</td><td>-</td></tr><tr><td></td><td>MaskFormer (ours)</td><td>R50 +6Enc</td><td>46.5</td><td>51.0 (+2.8)</td><td>39.8 (+3.5)</td><td>80.4</td><td>56.8</td><td>45M</td><td>181G</td><td>17.6</td></tr><tr><td>Ceee</td><td>DETR [3]</td><td>R101+6Enc</td><td>45.1</td><td>50.5</td><td>37.0</td><td>79.9</td><td>55.5</td><td>-</td><td>1</td><td>-</td></tr><tr><td></td><td>MaskFormer (ours)</td><td>R101 +6Enc</td><td>47.6</td><td>52.5 (+2.0)</td><td>40.3 (+3.3)</td><td>80.7</td><td>58.0</td><td>64M</td><td>248G</td><td>14.0</td></tr><tr><td></td><td>Max-DeepLab [38]</td><td>Max-S</td><td>48.4</td><td>53.0</td><td>41.5</td><td>-</td><td>·</td><td>62M</td><td>324G</td><td>7.6</td></tr><tr><td>rirrerigarrrseers</td><td></td><td>Max-L</td><td>51.1</td><td>57.0</td><td>42.2</td><td>-</td><td>1</td><td>451M</td><td>3692G</td><td>-</td></tr><tr><td></td><td></td><td>Swin-T</td><td>47.7</td><td>51.7</td><td>41.7</td><td>80.4</td><td>58.3</td><td>42M</td><td>179G</td><td>17.0</td></tr><tr><td></td><td></td><td>Swin-S</td><td>49.7</td><td>54.4</td><td>42.6</td><td>80.9</td><td>60.4</td><td>63M</td><td>259G</td><td>12.4</td></tr><tr><td></td><td>MaskFormer (ours)</td><td>Swin-B</td><td>51.1</td><td>56.3</td><td>43.2</td><td>81.4</td><td>61.8</td><td>102M</td><td>411G</td><td>8.4</td></tr><tr><td></td><td></td><td>Swin-B</td><td>51.8</td><td>56.9</td><td>44.1</td><td>81.4</td><td>62.6</td><td>102M</td><td>411G</td><td>8.4</td></tr><tr><td></td><td></td><td>Swin-L</td><td>52.7</td><td>58.5</td><td>44.0</td><td>81.8</td><td>63.5</td><td>212M</td><td>792G</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>5.2</td></tr></table>
Panoptic segmentation. In Table 3, we compare the same exact MaskFormer model with DETR [3] on the COCO panoptic val set. To match the standard DETR design, we add 6 additional Transformer encoder layers after the CNN backbone. Unlike DETR, our model does not predict bounding boxes but instead predicts masks directly. MaskFormer achieves better results while being simpler than DETR. To disentangle the improvements from the model itself and our post-processing inference strategy we run our model following DETR post-processing (MaskFormer (DETR)) and observe that this setup outperforms DETR by 2.2 PQ. Overall, we observe a larger improvement in $\mathrm { P Q } ^ { \mathrm { S t } }$ compared to $\mathrm { P Q } ^ { \mathrm { T h } }$ . This suggests that detecting “stuff” with bounding boxes is suboptimal, and therefore, boxbased segmentation models (e.g., Mask R-CNN [19]) do not suit semantic segmentation. MaskFormer also outperforms recently proposed Max-DeepLab [38] without the need of special network design as well as sophisticated auxiliary losses (i.e., instance discrimination loss, mask-ID cross entropy loss, and per-pixel classification loss in [38]). MaskFormer, for the first time, unifies semantic- and instance-level segmentation with the exact same model, loss, and training pipeline.
We further evaluate our model on the panoptic segmentation version of the ADE20K dataset. Our model also achieves state-of-the-art performance. We refer to the appendix for detailed results.
# 4.4 Ablation studies
We perform a series of ablation studies of MaskFormer using a single ResNet-50 backbone [20].
Per-pixel vs. mask classification. In Table 4, we verify that the gains demonstrated by MaskFromer come from shifting the paradigm to mask classification. We start by comparing PerPixelBaseline+ and MaskFormer. The models are very similar and there are only 3 differences: 1) per-pixel vs. mask classification used by the models, 2) MaskFormer uses bipartite matching, and 3) the new model uses a combination of focal and dice losses as a mask loss, whereas PerPixelBaseline+ utilizes per-pixel cross entropy loss. First, we rule out the influence of loss differences by training PerPixelBaseline $^ +$ with exactly the same losses and observing no improvement. Next, in Table 4a, we compare PerPixelBaseline $^ +$ with MaskFormer trained using a fixed matching (MaskFormer-fixed), i.e., $N = K$ and assignment done based on category label indices identically to the per-pixel classification setup. We observe that MaskFormer-fixed is 1.8 mIoU better than the baseline, suggesting that shifting from per-pixel classification to mask classification is indeed the main reason for the gains of MaskFormer. In Table 4b, we further compare MaskFormer-fixed with MaskFormer trained with bipartite matching (MaskFormer-bipartite) and find bipartite matching is not only more flexible (allowing to predict less masks than the total number of categories) but also produces better results.
Table 4: Per-pixel vs. mask classification for semantic segmentation. All models use 150 queries for a fair comparison. We evaluate the models on ADE20K val with 150 categories. 4a: PerPixelBaseline $^ +$ and MaskFormer-fixed use similar fixed matching (i.e., matching by category index), this result confirms that the shift from per-pixel to mask classification is the key. 4b: bipartite matching is not only more flexible (can make less prediction than total class count) but also gives better results.
(a) Per-pixel vs. mask classification.
(b) Fixed vs. bipartite matching assignment.
<table><tr><td></td><td>mIoU</td><td>PQSt</td></tr><tr><td>PerPixelBaseline+</td><td>41.9</td><td>28.3</td></tr><tr><td>MaskFormer-fixed</td><td>43.7 (+1.8)</td><td>30.3 (+2.0)</td></tr></table>
<table><tr><td></td><td>mIoU</td><td>PQSt</td></tr><tr><td>MaskFormer-fixed</td><td>43.7</td><td>30.3</td></tr><tr><td>MaskFormer-bipartite (ours)</td><td>44.2 (+0.5)</td><td>33.4 (+3.1)</td></tr></table>
Number of queries. The table to the right shows results of MaskFormer trained with a varying number of queries on datasets with different number of categories. The model with 100 queries consistently performs the best across the studied datasets. This suggest we may not need to adjust the number of queries w.r.t. the number of categories or datasets much. Interestingly, even with 20 queries MaskFormer outperforms our per-pixel classification baseline.
<table><tr><td># of queries</td><td>ADE20K mIoU PQS</td><td>mIoU</td><td>COCO-Stuff PQS</td><td>ADE20K-Full mIoU</td><td>PQS</td></tr><tr><td>PerPixelBaseline+</td><td>41.9</td><td>28.3</td><td>34.2</td><td>24.6 13.9</td><td>9.0</td></tr><tr><td>20</td><td>42.9</td><td>32.6</td><td>35.0 27.6</td><td>14.1</td><td>10.8</td></tr><tr><td>50</td><td>43.9</td><td>32.7</td><td>35.5 27.9</td><td>15.4</td><td>11.1</td></tr><tr><td>100</td><td> 44.5</td><td>33.4</td><td> 37.1</td><td>28.9 16.0</td><td>11.9</td></tr><tr><td>150</td><td>44.2</td><td>33.4</td><td>37.0</td><td>28.9 15.5</td><td>11.5</td></tr><tr><td>300</td><td>43.5</td><td>32.3</td><td>36.1</td><td>29.1 14.2</td><td>10.3</td></tr><tr><td>1000</td><td>35.4</td><td>26.7</td><td>34.4</td><td>27.6</td><td>8.0 5.8</td></tr></table>
We further calculate the number of classes which are on average present in a training set image. We find these statistics to be similar across datasets despite the fact that the datasets have different number of total categories: 8.2 classes per image for ADE20K (150 classes), 6.6 classes per image for COCO-Stuff-10K (171 classes) and 9.1 classes per image for ADE20K-Full (847 classes). We hypothesize that each query is able to capture masks from multiple categories.
The figure to the right shows the number of unique categories predicted by each query (sorted in descending order) of our MaskFormer model on the validation sets of the corresponding datasets. Interestingly, the number of unique categories per query does not follow a uniform distribution: some queries capture more classes than others. We try to analyze how MaskFormer queries group categories, but we do not observe any obvious pattern: there are queries capturing categories with similar semantics or shapes (e.g., “house” and “building”), but there are also queries capturing completely different categories (e.g., “water” and “sofa”).

Number of Transformer decoder layers. Interestingly, MaskFormer with even a single Transformer decoder layer already performs well for semantic segmentation and achieves better performance than our 6-layer-decoder PerPixelBaseline+. For panoptic segmentation, however, multiple decoder layers are required to achieve competitive performance. Please see the appendix for a detailed discussion.
# 5 Discussion
Our main goal is to show that mask classification is a general segmentation paradigm that could be a competitive alternative to per-pixel classification for semantic segmentation. To better understand its potential for segmentation tasks, we focus on exploring mask classification independently of other factors like architecture, loss design, or augmentation strategy. We pick the DETR [3] architecture as our baseline for its simplicity and deliberately make as few architectural changes as possible. Therefore, MaskFormer can be viewed as a “box-free” version of DETR.
Table 5: Matching with masks vs. boxes. We compare DETR [3] which uses box-based matching with two MaskFormer models trained with box- and mask-based matching respectively. To use box-based matching in MaskFormer we add to the model an additional box prediction head as in DETR. Note, that with box-based matching MaskFormer performs on par with DETR, whereas with mask-based matching it shows better results. The evaluation is done on COCO panoptic val set.
<table><tr><td>method</td><td>backbone</td><td>matching</td><td>PQ</td><td>PQTh</td><td>PQSt</td></tr><tr><td>DETR [3]</td><td>R50 +6Enc</td><td>by box</td><td>43.4</td><td>48.2</td><td>36.3</td></tr><tr><td rowspan="2">MaskFormer (ours)</td><td>R50 +6Enc</td><td>by box</td><td>43.7</td><td>49.2</td><td>35.3</td></tr><tr><td>R50+6Enc</td><td>by mask</td><td>46.5</td><td>51.0</td><td>39.8</td></tr></table>
In this section, we discuss in detail the differences between MaskFormer and DETR and show how these changes are required to ensure that mask classification performs well. First, to achieve a pure mask classification setting we remove the box prediction head and perform matching between prediction and ground truth segments with masks instead of boxes. Secondly, we replace the computeheavy per-query mask head used in DETR with a more efficient per-image FPN-based head to make end-to-end training without box supervision feasible.
Matching with masks is superior to matching with boxes. We compare MaskFormer models trained using matching with boxes or masks in Table 5. To do box-based matching, we add to MaskFormer an additional box prediction head as in DETR [3]. Observe that MaskFormer, which directly matches with mask predictions, has a clear advantage. We hypothesize that matching with boxes is more ambiguous than matching with masks, especially for stuff categories where completely different masks can have similar boxes as stuff regions often spread over a large area in an image.
MaskFormer mask head reduces computation. Results in Table 5 also show that MaskFormer performs on par with DETR when the same matching strategy is used. This suggests that the difference in mask head designs between the models does not significantly influence the prediction quality. The new head, however, has significantly lower computational and memory costs in comparison with the original mask head used in DETR. In MaskFormer, we first upsample image features to get highresolution per-pixel embeddings and directly generate binary mask predictions at a high-resolution. Note, that the per-pixel embeddings from the upsampling module (i.e., pixel decoder) are shared among all queries. In contrast, DETR first generates low-resolution attention maps and applies an independent upsampling module to each query. Thus, the mask head in DETR is $N$ times more computationally expensive than the mask head in MaskFormer (where $N$ is the number of queries).
# 6 Conclusion
The paradigm discrepancy between semantic- and instance-level segmentation results in entirely different models for each task, hindering development of image segmentation as a whole. We show that a simple mask classification model can outperform state-of-the-art per-pixel classification models, especially in the presence of large number of categories. Our model also remains competitive for panoptic segmentation, without a need to change model architecture, losses, or training procedure. We hope this unification spurs a joint effort across semantic- and instance-level segmentation tasks.
# Acknowledgments and Disclosure of Funding
We thank Ross Girshick for insightful comments and suggestions. Work of UIUC authors Bowen Cheng and Alexander G. Schwing was supported in part by NSF under Grant #1718221, 2008387, 2045586, 2106825, MRI #1725729, NIFA award 2020-67021-32799 and Cisco Systems Inc. (Gift Award CG 1377144 - thanks for access to Arcetri).
# References
[1] Pablo Arbeláez, Jordi Pont-Tuset, Jonathan T Barron, Ferran Marques, and Jitendra Malik. Multiscale combinatorial grouping. In CVPR, 2014. 2 [2] Holger Caesar, Jasper Uijlings, and Vittorio Ferrari. COCO-Stuff: Thing and stuff classes in context. In CVPR, 2018. 2, 5 [3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. 1, 2, 3, 4, 5, 6, 8, 9, 10 second-order pooling. In ECCV, 2012. 1, 2 [5] Joao Carreira and Cristian Sminchisescu. CPMC: Automatic object segmentation using constrained parametric min-cuts. PAMI, 2011. 2 [6] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. DeepLab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. PAMI, 2018. 2, 6 [7] Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv:1706.05587, 2017. 2, 6, 7 [8] Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In ECCV, 2018. 1, 6, 7 [9] Bowen Cheng, Liang-Chieh Chen, Yunchao Wei, Yukun Zhu, Zilong Huang, Jinjun Xiong, Thomas S Huang, Wen-Mei Hwu, and Honghui Shi. SPGNet: Semantic prediction guidance for scene parsing. In ICCV, 2019. [10] Bowen Cheng, Maxwell D Collins, Yukun Zhu, Ting Liu, Thomas S Huang, Hartwig Adam, and LiangChieh Chen. Panoptic-DeepLab: A simple, strong, and fast baseline for bottom-up panoptic segmentation. In CVPR, 2020. 6 [11] Dorin Comaniciu and Peter Meer. Robust Analysis of Feature Spaces: Color Image Segmentation. In CVPR, 1997. 2 [12] MMSegmentation Contributors. MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020. 6, 7 [13] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The Cityscapes dataset for semantic urban scene understanding. In CVPR, 2016. 2, 5 [14] Jifeng Dai, Kaiming He, and Jian Sun. Convolutional feature masking for joint object and stuff segmentation. In CVPR, 2015. 2 [15] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. 2, 7 [16] Mark Everingham, SM Ali Eslami, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The PASCAL visual object classes challenge: A retrospective. IJCV, 2015. 2, 5 [17] Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, and Hanqing Lu. Dual attention network for scene segmentation. In CVPR, 2019. 2 [18] Bharath Hariharan, Pablo Arbeláez, Ross Girshick, and Jitendra Malik. Simultaneous detection and segmentation. In ECCV, 2014. 1, 3 [19] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask R-CNN. In ICCV, 2017. 1, 3, 4, 8 [20] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 6, 7, 8 [21] Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. CCNet: Criss-cross attention for semantic segmentation. In ICCV, 2019. 2, 6 [22] Alexander Kirillov, Kaiming He, Ross Girshick, Carsten Rother, and Piotr Dollár. Panoptic segmentation. In CVPR, 2019. 2, 3, 5, 6 [23] Scott Konishi and Alan Yuille. Statistical Cues for Domain Specific Image Segmentation with Performance Analysis. In CVPR, 2000. 2 [24] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, 2017. 6 [25] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In ICCV, 2017. 4, 6 [26] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In ECCV, 2014. 2, 5 [27] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv:2103.14030, 2021. 2, 4, 6, 7 [28] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015. 1, 2 [29] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019. 6 [30] Fausto Milletari, Nassir Navab, and Seyed-Ahmad Ahmadi. V-Net: Fully convolutional neural networks for volumetric medical image segmentation. In 3DV, 2016. 4, 6 [31] Gerhard Neuhold, Tobias Ollmann, Samuel Rota Bulò, and Peter Kontschieder. The mapillary vistas dataset for semantic understanding of street scenes. In CVPR, 2017. 2, 5 [32] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 2015. 6 [33] Jianbo Shi and Jitendra Malik. Normalized Cuts and Image Segmentation. PAMI, 2000. 2 [34] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. arXiv:2105.05633, 2021. 2, 4 [35] Zhi Tian, Chunhua Shen, and Hao Chen. Conditional convolutions for instance segmentation. In ECCV, 2020. 3 [36] Jasper RR Uijlings, Koen EA Van De Sande, Theo Gevers, and Arnold WM Smeulders. Selective search for object recognition. IJCV, 2013. 2 [37] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. 1, 2, 3, 4 [38] Huiyu Wang, Yukun Zhu, Hartwig Adam, Alan Yuille, and Liang-Chieh Chen. MaX-DeepLab: End-to-end panoptic segmentation with mask transformers. In CVPR, 2021. 2, 3, 4, 8 [39] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018. 2 [40] Xinlong Wang, Rufeng Zhang, Tao Kong, Lei Li, and Chunhua Shen. SOLOv2: Dynamic and fast instance segmentation. NeurIPS, 2020. 3 [41] Yuxin Wu and Kaiming He. Group normalization. In ECCV, 2018. 6 [42] Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https: //github.com/facebookresearch/detectron2, 2019. 6 [43] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In ECCV, 2018. 7 [44] Yuhui Yuan, Xilin Chen, and Jingdong Wang. Object-contextual representations for semantic segmentation. In ECCV, 2020. 6, 7 [45] Yuhui Yuan, Lang Huang, Jianyuan Guo, Chao Zhang, Xilin Chen, and Jingdong Wang. OCNet: Object context for semantic segmentation. IJCV, 2021. 2 [46] Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. In CVPR, 2017. 1, 2, 6 [47] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021. 2, 4, 7 [48] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing challenge 2016. http://sceneparsing.csail.mit.edu/index_challenge.html, 2016. 5 [49] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ADE20K dataset. In CVPR, 2017. 2, 5123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401# A NEURAL STOCHASTIC VOLATILITY MODEL
Rui Luo†, Xiaojun $\mathbf { X } \mathbf { u } ^ { \ddag }$ , Weinan Zhang‡, Jun Wang† †University College London, $^ \ddag$ Shanghai Jiao Tong University {r.luo,j.wang}@cs.ucl.ac.uk, {xuxj,wnzhang}@apex.sjtu.edu.cn
# ABSTRACT
In this paper, we show that the recent integration of statistical models with recurrent neural networks provides a new way of formulating volatility models that have been popular in time series analysis and prediction. The model comprises a pair of complementary stochastic recurrent neural networks: the generative network models the joint distribution of the stochastic volatility process; the inference network approximates the conditional distribution of the latent variables given the observable ones. Our focus in this paper is on the formulation of temporal dynamics of volatility over time under a stochastic recurrent neural network framework. Our derivations show that some popular volatility models are a special case of our proposed neural stochastic volatility model. Experiments demonstrate that the proposed model generates a smoother volatility estimation, and outperforms standard econometric models GARCH, EGARCH, GJR-GARCH and some other GARCH variants as well as MCMC-based model stochvol and a recent Gaussian processes based volatility model GPVOL on several metrics about the fitness of the volatility modelling and the accuracy of the prediction.
# 1 INTRODUCTION
The volatility of the price movements reflects the ubiquitous uncertainty within financial markets. It is critical that the level of risk, indicated by volatility, is taken into consideration before investment decisions are made and portfolio are optimised (Hull, 2006); volatility is substantially a key variable in the pricing of derivative securities. Hence, estimating and forecasting volatility is of great importance in branches of financial studies, including investment, risk management, security valuation and monetary policy making (Poon & Granger, 2003).
Volatility is measured typically by using the standard deviation of price change in a fixed time interval, such as a day, a month or a year. The higher the volatility, the riskier the asset. One of the primary challenges in designing volatility models is to identify the existence of latent (stochastic) variables or processes and to characterise the underlying dependences or interactions between variables within a certain time span. A classic approach has been to handcraft the characteristic features of volatility models by imposing assumptions and constraints, given prior knowledge and observations. Notable examples include autoregressive conditional heteroskedasticity (ARCH) model (Engle, 1982) and its generalisation GARCH (Bollerslev, 1986), which makes use of autoregression to capture the properties of time-variant volatility within many time series. Heston (1993) assumed that the volatility follows a Cox-Ingersoll-Ross (CIR) process (Cox et al., 1985) and derived a closed-form solution for options pricing. While theoretically sound, those approaches require strong assumptions which might involve complex probability distributions and non-linear dynamics that drive the process, and in practice, one may have to impose less prior knowledge and rectify a solution under the worst-case volatility case (Avellaneda & Paras, 1996).
In this paper, we take a fully data driven approach and determine the configurations with as few exogenous input as possible, or even purely from the historical data. We propose a neural network re-formulation of stochastic volatility by leveraging stochastic models and recurrent neural networks (RNNs). We are inspired by the recent development on variational approaches of stochastic (deep) neural networks (Kingma & Welling, 2013; Rezende et al., 2014) to a recurrent case (Chung et al., 2015; Fabius & van Amersfoort, 2014; Bayer & Osendorfer, 2014), and our formulation shows that existing volatility models such as the GARCH (Bollerslev, 1986) and the Heston model (Heston, 1993) are the special cases of our neural stochastic volatility formulation. With the hidden latent variables in the neural networks we naturally uncover the underlying stochastic process formulated from the models.
Experiments with synthetic data and real-world financial data are performed, showing that the proposed model outperforms the widely-used GARCH model on several metrics of the fitness and the accuracy of time series modelling and prediction: it verifies our model’s high flexibility and rich expressive power.
# 2 RELATED WORK
A notable volatility method is autoregressive conditional heteroskedasticity (ARCH) model (Engle, 1982): it can accurately capture the properties of time-variant volatility within many types of time series. Inspired by ARCH model, a large body of diverse work based on stochastic process for volatility modelling has emerged. Bollerslev (1986) generalised ARCH model to the generalised autoregressive conditional heteroskedasticity (GARCH) model in a manner analogous to the extension from autoregressive (AR) model to autoregressive moving average (ARMA) model by introducing the past conditional variances in the current conditional variance estimation. Engle & Kroner (1995) presented theoretical results on the formulation and estimation of multivariate GARCH model within simultaneous equations systems. The extension to multivariate model allows the covariances to present and depend on the historical information, which are particularly useful in multivariate financial models. Heston (1993) derived a closed-form solution for option pricing with stochastic volatility where the volatility process is a CIR process driven by a latent Wiener process such that the current volatility is no longer a deterministic function even if the historical information is provided. Notably, empirical evidences have confirmed that volatility models provide accurate forecasts (Andersen & Bollerslev, 1998) and models such as ARCH and its descendants/variants have become indispensable tools in asset pricing and risk evaluation.
On the other hand, deep learning (LeCun et al., 2015; Schmidhuber, 2015) that utilises nonlinear structures known as deep neural networks, powers various applications. It has triumph over pattern recognition challenges, such as image recognition (Krizhevsky et al., 2012; He et al., 2015; van den Oord et al., 2016), speech recognition (Hinton et al., 2012; Graves et al., 2013; Chorowski et al., 2015), machine translation (Sutskever et al., 2014; Cho et al., 2014; Bahdanau et al., 2014; Luong et al., 2015) to name a few.
Time-dependent neural networks models include RNNs with advanced neuron structure such as long short-term memory (LSTM) (Hochreiter & Schmidhuber, 1997), gated recurrent unit (GRU) (Cho et al., 2014), and bidirectional RNN (BRNN) (Schuster & Paliwal, 1997). Recent results show that RNNs excel for sequence modelling and generation in various applications (Graves, 2013; Gregor et al., 2015). However, despite its capability as non-linear universal approximator, one of the drawbacks of neural networks is its deterministic nature. Adding latent variables and their processes into neural networks would easily make the posterori computationally intractable. Recent work shows that efficient inference can be found by variational inference when hidden continuous variables are embedded into the neural networks structure (Kingma & Welling, 2013; Rezende et al., 2014). Some early work has started to explore the use of variational inference to make RNNs stochastic (Chung et al., 2015; Bayer & Osendorfer, 2014; Fabius & van Amersfoort, 2014). Bayer & Osendorfer (2014) and Fabius & van Amersfoort (2014) considered the hidden variables are independent between times, whereas (Fraccaro et al., 2016) utilised a backward propagating inference network according to its Markovian properties. Our work in this paper extends the work (Chung et al., 2015) with a focus on volatility modelling for time series. We assume that the hidden stochastic variables follow a Gaussian autoregression process, which is then used to model both the variance and the mean. We show that the neural network formulation is a general one, which covers two major financial stochastic volatility models as the special cases by defining the specific hidden variables and non-linear transforms.
# 3 PRELIMINARY: VOLATILITY MODELS
Stochastic processes are often defined by stochastic differential equations (SDEs), e.g. a (univariate) generalised Wiener process is $\mathrm { d } x _ { t } = \mu \mathrm { d } t + \sigma \mathrm { d } w _ { t }$ , where $\mu$ and $\sigma$ denote the time-invariant rates of drift and standard deviation (square root of variance) while $\mathrm { d } w _ { t } \sim \mathcal { N } ( 0 , \mathrm { d } t )$ is the increment of
standard Wiener process at time $t$ . In a small time interval between $t$ and $t + \Delta t$ , the change in the variable is $\varDelta x _ { t } = \mu \varDelta t + \sigma \varDelta w _ { t }$ . Let $\varDelta t = 1$ , we obtain the discrete-time version of basic volatility model:
$$x _ { t } = x _ { t - 1 } + \mu + \sigma \epsilon _ { t } ,$$
where $\epsilon _ { t } \sim \mathcal { N } ( 0 , 1 )$ is a sample drawn from standard normal distribution. In the multivariate case, $\pmb { \Sigma }$ represents the covariance matrix in place of $\sigma ^ { 2 }$ . As presumed that the variables are multidimensional, we will use $\pmb { \Sigma }$ to represent variance in general case except explicitly noted.
# 3.1 DETERMINISTIC VOLATILITY
The time-invariant variance $\pmb { \Sigma }$ can be extended to be a function $\pmb { \mathscr { D } } _ { t } = \pmb { \mathscr { D } } ( \pmb { \mathscr { x } } _ { < t } )$ relying on history of the (observable) underlying stochastic process $\{ { \pmb x } _ { < t } \}$ . The current variance $\Sigma _ { t }$ is therefore determined given the history $\{ { \pmb x } _ { < t } \}$ up to time $t$ . An example of such extensions is the univariate GARCH(1,1) model (Bollerslev, 1986):
$$\sigma _ { t } ^ { 2 } = \alpha _ { 0 } + \alpha _ { 1 } ( x _ { t - 1 } - \mu _ { t - 1 } ) ^ { 2 } + \beta _ { 1 } \sigma _ { t - 1 } ^ { 2 } ,$$
where $x _ { t - 1 }$ is the observation from $\mathcal { N } ( \mu _ { t - 1 } , \sigma _ { t - 1 } ^ { 2 } )$ at time $t - 1$ . Note that the determinism is in a conditional sense, which means that it only holds under the condition that the complete history $\{ \pmb { x } _ { < t } \}$ is presented, such as the case of 1-step-ahead forecast. otherwise the current volatility would still be stochastic as it is built on stochastic process $\{ \pmb { x } _ { t } \}$ . However, for multi-step-ahead forecast, we usually exploit the relation $\mathbb { E } _ { t - 1 } [ ( x _ { t } - \mu _ { t } ) ^ { 2 } ] = \sigma _ { t } ^ { 2 }$ to substitute the corresponding terms and calculate the forecasts with longer horizon in a recursive fashion, for example, $\bar { \sigma _ { t + 1 } ^ { 2 } } = \bar { \alpha } _ { 0 } + \alpha _ { 1 } \mathbb { E } _ { t - 1 } [ ( x _ { t } -$ $\mu _ { t } ) ^ { 2 } ] + \beta _ { 1 } \sigma _ { t } ^ { 2 } = \alpha _ { 0 } + ( \alpha _ { 1 } + \beta _ { 1 } ) \sigma _ { t } ^ { 2 }$ . For $\mathbf { n }$ -step-ahead forecast, there will be $n$ iterations and the procedure is hence also deterministic.
# 3.2 STOCHASTIC VOLATILITY
Another extension is applicable for $\Sigma _ { t }$ from being conditionally deterministic (i.e. deterministic given the complete history $\{ { \pmb x } _ { < t } \} )$ to fully stochastic: $\pmb { \mathscr { D } } _ { t } = \pmb { \mathscr { D } } ( \pmb { z } _ { \le t } )$ is driven by another latent stochastic process $\{ z _ { t } \}$ instead of the observable process $\{ x _ { t } \}$ . Heston (1993) model instantiates a continuous-time stochastic volatility model for univariate processes:
$$\begin{array} { r l } & { \mathrm { d } x _ { t } = ( \mu - 0 . 5 \sigma _ { t } ^ { 2 } ) \mathrm { d } t + \sigma _ { t } \mathrm { d } w _ { t } ^ { \langle 1 \rangle } , } \\ & { \mathrm { d } \sigma _ { t } = a \sigma _ { t } \mathrm { d } t + b \mathrm { d } w _ { t } ^ { \langle 2 \rangle } , } \end{array}$$
where the correlation between d wh1t i and d wh2it applies: $\mathbb { E } [ \mathrm { d } w _ { t } ^ { ( 1 ) } \cdot \mathrm { d } w _ { t } ^ { \langle 2 \rangle } ] = \rho \mathrm { d } t$ . We apply Euler’s scheme of quantisation (Stoer & Bulirsch, 2013) to obtain the discrete analogue to the continuoustime Heston model (Eqs. (3) and (4)):
$$\begin{array}{c} \begin{array} { r l } & { x _ { t } = ( x _ { t - 1 } + \mu - 0 . 5 \sigma _ { t } ^ { 2 } ) + \sigma \epsilon _ { t } } \\ & { \sigma _ { t } = ( 1 + a ) \sigma _ { t - 1 } + b z _ { t } } \end{array} \quad \mathrm { w h e r e } \quad \begin{array} { l } { \Big [ \epsilon _ { t } } \\ { z _ { t } } \end{array} \Big ] = \mathcal { N } ( \mathbf { 0 } , \Big [ \begin{array} { l l } { 1 } & { \rho } \\ { \rho } & { 1 } \end{array} \Big ] ) . \end{array}$$
# 3.3 VOLATILITY MODEL IN GENERAL
As discussed above, the observable variable $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ follows Gaussian distribution of which the mean and variance depend on the history of observable process $\{ x _ { t } \}$ and latent $\left\{ { z } _ { t } \right\}$ . We presume in addition that the latent process $\{ z _ { t } \}$ is an autoregressive model such that ${ \boldsymbol { z } } _ { t }$ is (conditionally) Gaussian distributed. Therefore, we formulate the volatility model in general as:
$$\begin{array} { r l } & { z _ { t } \sim \mathcal { N } ( \pmb { \mu } ^ { z } ( \pmb { z } _ { < t } ) , \pmb { \Sigma } ^ { z } ( \pmb { z } _ { < t } ) ) , } \\ & { \pmb { x } _ { t } \sim \mathcal { N } ( \pmb { \mu } ^ { x } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } ) , \pmb { \Sigma } ^ { x } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } ) ) , } \end{array}$$
where $\pmb { \mu } ^ { z } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } )$ and $\begin{array} { r } { \pmb { \Sigma } ^ { z } ( \pmb { x } _ { < t } , z _ { \leq t } ) } \end{array}$ denote the autoregressive time-varying mean and variance of the latent variable ${ \boldsymbol { z } } _ { t }$ while $\pmb { \mu } ^ { x } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } )$ and $\begin{array} { r } { \pmb { \Sigma ^ { x } } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } ) } \end{array}$ represent the mean and variance of observable variable $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , which depend on not only history of the observable process $\{ \pmb { x } _ { < t } \}$ but that of the latent process $\{ { z } _ { \leq t } \}$ .
These two formulas (Eqs. (6) and (7)) abstract the generalised formulation of volatility models. Together, they represents a broad family of volatility models with latent variables, where the Heston model for stochastic volatility is merely a special case of the family. Furthermore, it will degenerate to deterministic volatility models such as the well-studied GARCH model if we disable the latent process.
# 4 NEURAL STOCHASTIC VOLATILITY MODELS
In this section, we establish the neural stochastic volatility model (NSVM) for stochastic volatility estimation and forecast.
# 4.1 GENERATING OBSERVABLE SEQUENCE
Recall that the latent variable $z _ { t }$ (Eq. (6)) and the observable $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ (Eq. (7)) are described by autoregressive models ${ \bf \nabla } _ { { \bf \mathcal { X } } _ { t } }$ has the exogenous input $\{ { z } _ { \leq t } \}$ .) For the distributions of $\{ z _ { t } \}$ and $\{ x _ { t } \}$ , the following factorisation applies:
$$\begin{array} { c } { { p _ { \Phi } ( Z ) = \displaystyle \prod _ { t } p _ { \Phi } ( z _ { t } | z _ { < t } ) = \displaystyle \prod _ { t } { \mathcal N } ( z _ { t } ; \mu _ { \Phi } ^ { z } ( z _ { < t } ) , \Sigma _ { \Phi } ^ { z } ( z _ { < t } ) ) , } } \\ { { p _ { \Phi } ( X | Z ) = \displaystyle \prod _ { t } p _ { \Phi } ( x _ { t } | x _ { < t } , z _ { \le t } ) = \displaystyle \prod _ { t } { \mathcal N } ( x _ { t } ; \mu _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) , \Sigma _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) ) , } } \end{array}$$
where ${ \pmb X } = \{ { \pmb x } _ { t } \}$ and $Z = \{ z _ { t } \}$ are the sequences of observable and latent variables, respectively, while $\Phi$ represents the parameter set of the model. The full generative model is defined as the joint distribution:
$$\begin{array} { l } { { \displaystyle p _ { \Phi } ( X , Z ) = \prod _ { t } p _ { \Phi } ( x _ { t } | x _ { < t } , z _ { \le t } ) p _ { \Phi } ( z _ { t } | z _ { < t } ) } } \\ { { \displaystyle \qquad = \prod _ { t } \mathcal { N } ( z _ { t } ; \mu _ { \Phi } ^ { z } ( z _ { < t } ) , \Sigma _ { \Phi } ^ { z } ( z _ { < t } ) ) \mathcal { N } ( x _ { t } ; \mu _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) , \Sigma _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) ) . } } \end{array}$$
It is observed that the means and variances are conditionally deterministic: given the historical information $\{ z _ { < t } \}$ , the current mean $\mu _ { t } ^ { z } = \mu _ { \Phi } ^ { z } ( z _ { < t } )$ and variance $\begin{array} { r } { \pmb { \Sigma _ { t } ^ { z } } = \pmb { \Sigma _ { \Phi } ^ { z } } ( \pmb { z } _ { < t } ) } \end{array}$ of ${ \boldsymbol { z } } _ { t }$ is obtained and hence the distribution $\mathcal { N } ( z _ { t } ; \mu _ { t } ^ { z } , \Sigma _ { t } ^ { z } )$ of ${ \boldsymbol { z } } _ { t }$ is specified; after sampling ${ \boldsymbol { z } } _ { t }$ from the specified distribution, we incorporate $\{ \pmb { x } _ { < t } \}$ and calculate the current mean $\pmb { \mu } _ { t } ^ { x } = \pmb { \mu } _ { \Phi } ^ { x } ( \pmb { x } _ { < t } , \pmb { z } _ { \leq t } )$ and variance $\begin{array} { r } { \Sigma _ { t } ^ { x } = \Sigma _ { \Phi } ^ { x } ( \pmb { x } _ { < t } , \pmb { z } _ { \le t } ) } \end{array}$ of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and determine its distribution $\mathcal { N } ( \pmb { x } _ { t } ; \pmb { \mu } _ { t } ^ { x } , \pmb { \Sigma } _ { t } ^ { x } )$ of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . It is natural and convenient to present such a procedure in a recurrent fashion because of its autoregressive nature. As is known that RNNs can essentially approximate arbitrary function of recurrent form (Hammer, 2000), the means and variances, which may be driven by complex non-linear dynamics, can be efficiently computed using RNNs.
It is always a good practice to reparameterise the random variables before we go into RNN architecture. As the covariance matrix $\pmb { \Sigma }$ is symmetric and positive definite, it can be factorised as $\Sigma = U A U ^ { \top }$ , where $\pmb { A }$ is a full-rank diagonal matrix with positive diagonal elements. Let $A = U A ^ { \frac { 1 } { 2 } }$ , we have $\pmb { \Sigma } = \pmb { A } \pmb { A } ^ { \top }$ . Hence we can reparameterise the latent variable ${ \boldsymbol { z } } _ { t }$ (Eq. (6)) and observable $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ (Eq. (7)):
$$\begin{array} { r } { z _ { t } = \pmb { \mu } _ { t } ^ { z } + \pmb { A } _ { t } ^ { z } \pmb { \epsilon } _ { t } ^ { z } , } \\ { \pmb { x } _ { t } = \pmb { \mu } _ { t } ^ { x } + \pmb { A } _ { t } ^ { x } \pmb { \epsilon } _ { t } ^ { x } , } \end{array}$$
where $A _ { t } ^ { z } ( A _ { t } ^ { z } ) ^ { \top } = \Sigma _ { t } ^ { z }$ , $A _ { t } ^ { x } ( A _ { t } ^ { x } ) ^ { \top } = \Sigma _ { t } ^ { x }$ and $\epsilon _ { t } ^ { x } \sim \mathcal { N } ( \mathbf { 0 } , I _ { x } ) , \epsilon _ { t } ^ { z } \sim \mathcal { N } ( \mathbf { 0 } , I _ { z } )$ are auxiliary variables. Note that the randomness within the variables of interest (e.g. ${ \boldsymbol { z } } _ { t }$ ) is extracted by the auxiliary variables (e.g. $\epsilon _ { t . }$ ) which follow the standard distributions. Hence, the reparameterisation guarantees that gradient-based methods can be applied in learning phase (Kingma & Welling, 2013).
In this paper, the joint generative model is comprised of two sets of RNN and multilayer perceptron (MLP): $\mathrm { \bar { R N N } } _ { g } ^ { z } / \mathrm { \bar { M L P } } _ { g } ^ { z }$ for the latent variable, while $\mathrm { R N N } _ { g } ^ { x } / \mathrm { M L P } _ { g } ^ { z }$ for the observables. We stack these two RNN/MLP together according to the causal dependency between those variables. The joint generative model is implemented as the generative network:
$$\begin{array} { r l } & { \{ \mu _ { t } ^ { z } , A _ { t } ^ { z } \} = \mathrm { M L P } _ { g } ^ { z } ( h _ { t } ^ { z } ; \Phi ) , } \\ & { \quad \quad h _ { t } ^ { z } = \mathrm { R N N } _ { g } ^ { z } ( h _ { t - 1 } ^ { z } , z _ { t - 1 } ; \Phi ) , } \\ & { \quad \quad z _ { t } = \mu _ { t } ^ { z } + A _ { t } ^ { z } \epsilon _ { t } ^ { z } , } \\ & { \{ \mu _ { t } ^ { x } , A _ { t } ^ { x } \} = \mathrm { M L P } _ { g } ^ { x } ( h _ { t } ^ { x } ; \Phi ) , } \\ & { \quad \quad h _ { t } ^ { x } = \mathrm { R N N } _ { g } ^ { x } ( h _ { t - 1 } ^ { x } , x _ { t - 1 } , z _ { t } ; \Phi ) , } \\ & { \quad \quad x _ { t } = \mu _ { t } ^ { x } + A _ { t } ^ { x } \epsilon _ { t } ^ { x } , } \end{array}$$
where $ { \boldsymbol { h } } _ { t } ^ { z }$ and ${ h } _ { t } ^ { x }$ denote the hidden states of the corresponding RNNs. The MLPs map the hidden states of RNNs into the means and deviations of variables of interest. The parameter set $\Phi$ is comprised of the weights of RNNs and MLPs.
One should notice that when the latent variable $_ z$ is obtained, e.g. by inference (details in the next subsection), the conditional distribution $p _ { \Phi } ( \pmb { X } | Z )$ (Eq. (9)) will involve in generating the observable $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ instead of the joint distribution $p _ { \Phi } ( X , Z )$ (Eq. (10)). This is essentially the scenario of predicting future values of the observable variable given its history. We will use the term “generative model” and will not discriminate the joint generative model or the conditional one as it can be inferred in context.
# 4.2 INFERENCING THE LATENT PROCESS
As the generative model involves latent variable ${ \boldsymbol { z } } _ { t }$ , of which the true valus are unaccessible even we have observed $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . Hence, the marginal likelihood $p _ { \Phi } ( X )$ becomes the key that bridges the model and the data. The calculation of marginal likelihood involves the posterior distribution $p _ { \Phi } ( Z | X )$ , which is often intractable as complex integrals are involved. We are unable to learn the paramters or to infer the latent variables. Therefore, we consider instead a restricted family of tractable distributions $q _ { \Psi } ( Z | X )$ , referred to as the approximate posterior family, as approximations to the true posterior $p _ { \Phi } ( Z | X )$ such that the family is sufficiently rich and flexible to provide good approximations (Bishop, 2006; Kingma & Welling, 2013; Rezende et al., 2014).
We define the inference model in accordance with the approximate posterior family we have presumed, in a similar fashion as (Chung et al., 2015), where the factorised distribution is formulated as follows:
$$q _ { \Psi } ( Z | X ) = \prod _ { t } q _ { \Psi } ( z _ { t } | z _ { < t } , \pmb { x } _ { < t } ) = \prod _ { t } \mathcal { N } ( z _ { t } ; \tilde { \mu } _ { \Psi } ^ { z } ( z _ { < t } , \pmb { x } _ { < t } ) , \tilde { \Sigma } _ { \Psi } ^ { z } ( z _ { < t } , \pmb { x } _ { < t } ) ) ,$$
where $\tilde { \mu } _ { \Psi } ^ { z } ( \boldsymbol { z } _ { < t } , \boldsymbol { x } _ { < t } )$ and $\tilde { \Sigma } _ { \Psi } ^ { z } ( z _ { < t } , \pmb { x } _ { < t } )$ are functions of the historical information $\{ { \boldsymbol { z } } _ { < t } \} , \{ { \boldsymbol { x } } _ { < t } \}$ , representing the approximated mean and variance of the latent variable ${ \boldsymbol { z } } _ { t }$ , respectively. Note that $\pmb { \psi }$ represents the parameter set of inference model.
The inference model essentially describes an autoregressive model on ${ \boldsymbol { z } } _ { t }$ with exogenous input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . Hence, in a similar fashion as the generative model, we implement the inference model as the inference network using RNN/MLP:
$$\begin{array} { r l } & { \{ \tilde { \pmb { \mu } } _ { t } ^ { z } , \tilde { \pmb { A } } _ { t } ^ { z } \} = \mathrm { M L P } _ { i } ^ { z } ( \tilde { \pmb { h } } _ { t } ^ { z } ) , } \\ & { \quad \quad \quad \tilde { \pmb { h } } _ { t } ^ { z } = \mathrm { R N N } _ { i } ^ { z } ( \tilde { \pmb { h } } _ { t - 1 } ^ { z } , z _ { t - 1 } , { \pmb { x } } _ { t - 1 } ) , } \\ & { \quad \quad \quad z _ { t } = \tilde { \pmb { \mu } } _ { t } ^ { z } + \tilde { \pmb { A } } _ { t } ^ { z } \tilde { \epsilon } _ { t } ^ { z } , } \end{array}$$
where $\tilde { A } _ { t } ^ { z } ( \tilde { A } _ { t } ^ { z } ) ^ { \top } = \tilde { \Sigma } _ { t } ^ { z } = \tilde { \Sigma } _ { \Psi } ^ { z } ( z _ { < t } , { \pmb x } _ { < t } )$ while $\tilde { h } _ { t } ^ { z }$ represents the hidden state of RNN and $\tilde { \epsilon } _ { t } ^ { z } \sim$ $\textstyle \mathcal { N } ( \mathbf { 0 } , \pmb { I } _ { z } )$ is an auxiliary variable to extract randomness. The inference mean $\tilde { \mu } _ { t } ^ { z }$ and deviation $\tilde { A } _ { t } ^ { z }$ is computed by an MLP from the hidden state $\tilde { h } _ { t } ^ { z }$ . We use the subscript $i$ instead of $g$ to distinguish the architecture used in inference model in contrast to generative model.
# 4.3 FORECASTING OBSERVATIONS IN FUTURE
In the realm of time series analysis, we usually pay more attention on forecasting over generating (Box et al., 2015). It means that we are essentially more interested in the generation procedure conditioning on the historical information rather than generation purely based on a priori belief since the observations in the past of $\scriptstyle { \mathbf { { \mathcal { x } } } } _ { < t }$ influences our belief of the latent variable ${ \boldsymbol { z } } _ { t }$ . Therefore, we apply the approximate posterior distribution of the latent variable ${ \boldsymbol { z } } _ { t }$ (Eq. (19)) as discussed in previous subsection, in place of the prior distribution (Eq. (8)) to build our predictive model.
 Figure 1: Forecasting the future using Neural Stochastic Volatility Model.
Given the historical observations $\scriptstyle { \mathbf { \mathcal { x } } } _ { < t }$ , the predictive model infers the current value of latent variable ${ \boldsymbol { z } } _ { t }$ using inference network and then generates the prediction of the current observation $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ using generative network. The procedure of forecasting is shown in Fig. 1.
NSVM is learned using Stochastic Gradient Variational Bayes following (Kingma & Welling, 2013; Rezende et al., 2014). For readability, we provide the detailed derivation in Appendix A.
# 4.4 LINKS TO GARCH(1,1) AND HESTON MODEL
Although we refer to GARCH and Heston as volatility models, the purposes of them are quite different: GARCH is a predictive model used for volatility forecasting whereas Heston is more of a generative model of the underlying dynamics which facilitate closed-form solutions to SDEs in option pricing. The proposed NSVM has close relations to GARCH(1,1) and Heston model: both of them can be regarded as a special case of the neural network formulation. Recall Eq. (2), GARCH(1,1) is formulated as $\sigma _ { t } ^ { 2 } \stackrel { . } { = } \alpha _ { 0 } + \alpha _ { 1 } ( x _ { t - 1 } - \mu _ { t - 1 } ) ^ { 2 } + \beta _ { 1 } \sigma _ { t - 1 } ^ { 2 }$ , where $\mu _ { t - 1 }$ is the trend estimate of $\{ x _ { t } \}$ at time step $t$ calculated by some mean models. A common practice is to assume that $\mu _ { t }$ follows the ARMA family (Box et al., 2015), or even simpler, as a constant that $\mu _ { t } \equiv \mu$ . We adopt the constant trend for simplicity as our focus is on volatility estimation.
We define the hidden state as $h _ { t } ^ { x } = [ \mu , \sigma _ { t } ] ^ { \top }$ , and disable the latent variable $z _ { t } \equiv 0$ as the volatility modelled by GARCH(1,1) is conditionally deterministic. Hence, we instantiate the generative network (Eqs. (16), (17) and (18)) as follows:
$$\begin{array} { r l r } { { \{ \mu , \sigma _ { t } \} = \mathrm { M L P } _ { g } ^ { x } ( h _ { t } ^ { x } ; \Phi ) = \{ [ 1 , 0 ] h _ { t } ^ { x } , [ 0 , 1 ] h _ { t } ^ { x } \} , } } \\ & { } & { h _ { t } ^ { x } = \mathrm { R N N } _ { g } ^ { x } ( h _ { t - 1 } ^ { x } , x _ { t - 1 } ; \Phi ) } \\ & { } & { = \sqrt { [ \begin{array} { l } { 0 } \\ { \alpha _ { 0 } } \end{array} ] + [ \begin{array} { l } { 0 } \\ { \alpha _ { 1 } } \end{array} ] ( x _ { t - 1 } - [ 1 , 0 ] h _ { t - 1 } ^ { x } ) ^ { 2 } + [ \begin{array} { l l } { 1 } & { 0 } \\ { 0 } & { \beta _ { 1 } } \end{array} ] ( h _ { t - 1 } ^ { x } ) ^ { 2 } } , } \\ & { } & { x _ { t } = \mu + \sigma _ { t } \epsilon _ { t } \qquad \mathrm { w h e r e } ~ \epsilon _ { t } \sim \mathcal { N } ( 0 , 1 ) . } \end{array}$$
The set of generative parameters is $\Phi = \{ \mu , \alpha _ { 0 } , \alpha _ { 1 } , \beta _ { 1 } \}$ .
Next, we show the link between NSVM and (discrete-time) Heston model (Eq. (5)). Let $h _ { t } ^ { x } \ =$ $[ x _ { t - 1 } , \mu , \sigma _ { t } ] ^ { \top }$ be the hidden state and $z _ { t }$ be i.i.d. standard Gaussian instead of autoregressive vari
able, we represent the Heston model in the framework of NSVM as:
$$\begin{array} { r l } & { \quad \left[ \epsilon _ { t } \right] = \mathcal { N } ( \mathbf { 0 } , \left[ \begin{array} { l l } { 1 } & { \rho } \\ { \rho } & { 1 } \end{array} \right] ) , } \\ & { \lbrace \mu _ { t } , \sigma _ { t } \rbrace = \mathrm { M L P } _ { g } ^ { x } ( h _ { t } ^ { x } ; \Phi ) = \lbrace [ 1 , 1 , 0 ] h _ { t } ^ { x } - [ 0 , 0 , 0 . 5 ] ( h _ { t } ^ { x } ) ^ { 2 } , [ 0 , 0 , 1 ] h _ { t } ^ { x } \rbrace , } \\ & { \quad \quad h _ { t } ^ { x } = \mathrm { R N N } _ { g } ^ { x } ( h _ { t - 1 } ^ { x } , x _ { t - 1 } , z _ { t } ; \Phi ) } \\ & { \quad \quad \quad = \left[ \begin{array} { l l l } { 0 } & { 0 } & { 0 } \\ { 0 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 1 + a } \end{array} \right] h _ { t - 1 } ^ { x } + \left[ \begin{array} { l } { 1 } \\ { 0 } \end{array} \right] x _ { t - 1 } + \left[ \begin{array} { l } { 0 } \\ { 0 } \end{array} \right] z _ { t } , } \\ & { \quad \quad x _ { t } = \mu _ { t } + \sigma _ { t } \epsilon _ { t } . } \end{array}$$
The set of generative parameters is $\Phi = \{ \mu , a , b \}$
One should notice that, in practice, the formulation may change in accordance with the specific architecture of neural networks involved in building the model, and hence a closed-form representation may be absent.
# 5 EXPERIMENTS
In this section, we present our experiments1 both on the synthetic and real-world datasets to validate the effectiveness of NSVM.
# 5.1 BASELINES AND EVALUATION METRICS
To evaluate the performance of volatility modelling, we adopt the standard econometric model GARCH(1,1) Bollerslev (1986) as well as its variants EGARCH(1,1) Nelson (1991), GJR-GARCH(1,1,1) Glosten et al. (1993), ARCH(5), TARCH(1,1,1), APARCH(1,1,1), AGARCH(1,1,1), NAGARCH(1,1,1), IGARCH(1,1), IAVGARCH(1,1), FIGARCH(1,d,1) as baselines, which incorporate with the corresponding mean model AR(20). We would also compare our NSVM against a MCMC-based model “stochvol” and the recent Gaussian-processes-based model “GPVOL” Wu et al. (2014), which is a non-parametric model jointly learning the dynamics and hidden states via online inference algorithm. In addition, we setup a naive forecasting model as an alternative baseline referred to as NAIVE, which maintains a sliding window of size 20 on the most recent historical observations and forecasts the current values of mean and volatility by the average mean and variance of the window.
For synthetic data experiments, we take four metrics into consideration for performance evaluation: 1) the negative log-likelihood (NLL) of observing the test sequence with respect to the generative model parameters; 2) the mean-squared error (MSE) between the predicted mean and the ground truth ( $\mu$ -MSE), 3) MSE of the predicted variance against the true variance ( $\sigma$ -MSE); 4) smoothness of fit, which is the standard deviation of the differences of succesive variance estimates. As for the real-world scenarios, the trend and volatility are implicit such that no ground truth is accessible to compare with, we consider only NLL and smoothness as the metrics for evaluation on real-world data experiment.
# 5.2 MODEL IMPLEMENTATION
The implementation of NSVM in experiments is in accordance with the architecture illustrated in Fig. 1: it consists of two neural networks, namely inference network and generative network. Each network comprises a set of RNN/MLP as we have discussed above: the RNN is instantiated by stacked LSTM layers whereas the MLP is essentially a 1-layer fully-connected feedforward network which splits into two equal-sized sublayers with different activation functions – one sublayer applies exponential function to impose the non-negativity and prevents overshooting of variance estimates while the other uses linear function to calculate mean estimates. During experiment, the model is structured by cascading the inference network and generative network as depicted in Fig. 1. The input layer is of size 20, which is the same as the embedding dimension $D _ { E }$ ; the layer on the interface of inference network and generative network – we call it latent variable layer – represents the latent variable $z$ , where its dimension is 2. The output layer has the same structure as the input one, therefore the latent variable layer acts as a bottleneck of the entire architecture which helps to extract the key factor. The stacked layers between input layer, latent variable layer and output layer are the hidden layers of either inference network or generative network, it consists of 1 or 2 LSTM layers with size 10, which contains recurrent connection for temporal dependencies modelling.
State-of-the-art learning techniques have been applied: we introduce Dropout (Zaremba et al., 2014) into each LSTM recurrent layer and impose L2-norm on the weights of each fully-connected feedforward layer as regularistion; NADAM optimiser (Dozat, 2015) is exploited for fast convergence, which is a variant of ADAM optimiser (Kingma & Ba, 2014) incorporated with Nesterov momentum; stepwise exponential learning rate decay is adopted to anneal the variations of convergence as time goes.
For econometric models, we utilise several widely-used packages for time series analysis: statsmodels (http://statsmodels.sourceforge.net/), arch (https://pypi.python. org/pypi/arch/3.2), Oxford-MFE-toolbox (https://www.kevinsheppard. com/MFE_Toolbox), stochvol (https://cran.r-project.org/web/packages/ stochvol) and fGarch (https://cran.r-project.org/web/packages/fGarch). The implementation of GPVOL is retrived from http://jmhl.org and we adopt the same hyperparameter setting as in Wu et al. (2014).
# 5.3 SYNTHETIC DATA EXPERIMENT
We build up the synthetic dataset by generating 256 heteroskedastic univariate time series, each with 2000 data points i.e. 2000 time steps. At each time step, the observation is drawn from a Gaussian distribution with pre-determined mean and variance, where the tendency of mean and variance is synthesised as linear combinations of sine functions. Specifically, for the trend and variance, we synthesis each using 3 sine functions with randomly chosen amplitudes and frequencies; then the value of the synthesised signal at each timestep is drawn from a Gaussian distribution with the corresponding value of trend and variance at that timestep. A sampled sequence is shown in Fig. 2a. We expect that this limited dataset could well simulate the real-world scenarios: one usually has very limited chances to observe and collect a large amount of data from time-invariant distributions. In addition, it seems that every observable or latent quantity within time series varies from time to time and seldom repeats the old patterns. Hence, we presume that the tendency shows long-term patterns and the period of tendency is longer than observation. In the experiment, we take the former 1500 time steps as the training set whereas the latter 500 as the test set.
For the synthetic data experiment, we simplify the recurrent layers in both inference net and generative net as single LSTM layer of size 10. The actual input $\{ \vec { \pmb { x } } _ { t } \}$ fed to NSVM is $D _ { E }$ - dimensional time-delay embedding (Kennel et al., 1992) of raw univariate observation $\{ x _ { t } \}$ such that $\vec { \pmb { x } } _ { t } = [ x _ { t + 1 - D _ { E } } , \ldots , x _ { t } ]$ . 2-dimensional latent variable ${ \boldsymbol { z } } _ { t }$ is adopted to capture the latent process, and enforces an orthogonal representation of the process by using diagonal covariance matrix. At each time step, 30 samples of latent variable ${ \boldsymbol { z } } _ { t }$ are generated via reparameterisation (Eq. (22)).
# 5.4 REAL-WORLD DATA EXPERIMENT
We select 162 out of more than 1500 stocks from Chinese stock market and collect the time series of their daily closing prices from 3 institutions in China. We favour those with earlier listing date of trading (from 2006 or earlier) and fewer suspension days (at most 50 suspension days in total during the period of observation) so as to reduce the noise introduced by insufficient observation or missing values, which has significant influences on the performance but is essentially irrelevant to the purpose of volatility forecasting. More specifically, the dataset obtained contains 162 time series, each with 2552 data points (7 years). A sampled sequence is shown in Fig. 2b. We divide the whole dataset into two subsets: the training subset consists of the first 2000 data points while the test subset contains the rest 552 data points.
Similar model configuration is applied to the real-world data experiment: time-delay embedding of dimension $D _ { E }$ on the raw univariate time series; 2-dimensional latent variable with diagonal (a) Synthetic time series prediction. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The groundtruth data variance and the corresponding prediction from GARCH(1,1) and NSVM.

 Figure 2: A case study of time series prediction.
(b) Real-world stock price prediction. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The variance prediction from GARCH(1,1) and NSVM. The prediction of NSVM is more smooth and stable than that of GARCH(1,1), also yielding smaller NLL.
covariance matrix; 30 sampling for the latent variable at each time step. Instead of single LSTM layers, here we adopt stacked LSTM layers composed of $2 \times 1 0$ LSTM cells.
# 5.5 RESULT AND DISCUSSION
The overall performance of NSVM and baselines is listed in details in Table 1 and case studies on synthetic data and real-world financial data are illustrated in Fig. 2. The results show that NSVM has higher accuracies for modelling heteroskedastic time series on various metrics: NLL shows the fitness of the model under likelihood measure; the smoothness indicates that NSVM obtains more robust representation of the latent volatility; $\mu$ -MSE and $\sigma$ -MSE in synthetic data experiment imply the ability of recognising the underlying patterns of both trend and volatility, which in fact verifies our claim of NSVM’s high flexibility and rich expressive power for volatility (as well as trend) modelling and forecasting compared with the baselines. Although the improvement comes at the cost of longer training time before convergence, it can be mitigated by applying parallel computing techniques as well as more advanced network architecture or training procedure.
Table 1: Results of the experiments.
<table><tr><td colspan="6">SYNTHETICDATA STOCKDATA</td></tr><tr><td></td><td>NLL</td><td>μ-MSE</td><td>σ-MSE</td><td>smoothness</td><td>NLL smoothness</td></tr><tr><td>NSVM</td><td>3.932e-2</td><td>2.393e-3</td><td>6.178e-4</td><td>4.322e-3</td><td>-2.184 3.505e-3</td></tr><tr><td>GARCH(1,1)</td><td>6.905e-2</td><td>7.594e-3*</td><td>8.408e-4</td><td>4.616e-3</td><td>-1.961 6.659e-3</td></tr><tr><td>GJRGARCH(1,1,1)</td><td>6.491e-2</td><td>7.594e-3*</td><td>7.172e-4</td><td>4.426e-3</td><td>-2.016 4.967e-3</td></tr><tr><td>EGARCH(1,1)</td><td>5.913e-2</td><td>7.594e-3*</td><td>8.332e-4</td><td>4.546e-3</td><td>-2.001 5.451e-3</td></tr><tr><td>ARCH(5)</td><td>7.577e-2</td><td>7.594e-3*</td><td>1.610e-3</td><td>5.880e-3</td><td>-1.955 7.917e-3</td></tr><tr><td>TARCH(1,1,1)</td><td>6.365e-2</td><td>7.594e-3*</td><td>7.284e-4</td><td>4.727e-3</td><td>-2.012 3.399e-3</td></tr><tr><td>APARCH(1,1,1)</td><td>6.187e-2</td><td>7.594e-3*</td><td>9.115e-4</td><td>4.531e-3</td><td>-2.014 4.214e-3</td></tr><tr><td>AGARCH(1,1)</td><td>6.311e-2</td><td>7.594e-3*</td><td>9.543e-4</td><td>4.999e-3</td><td>-2.008 5.847e-3</td></tr><tr><td>NAGARCH(1,1,1)</td><td>1.134e-1</td><td>7.594e-3*</td><td>9.516e-4</td><td>4.904e-3</td><td>-2.020 5.224e-3</td></tr><tr><td>IGARCH(1,1)</td><td>6.751e-2</td><td>7.594e-3*</td><td>9.322e-4</td><td>4.019e-3</td><td>-1.999 4.284e-3</td></tr><tr><td>IAVGARCH(1,1)</td><td>6.901e-2</td><td>7.594e-3*</td><td>7.174e-4</td><td>4.282e-3</td><td>-1.984 4.062e-3</td></tr><tr><td>FIGARCH(1,d,1)</td><td>6.666e-2</td><td>7.594e-3*</td><td>1.055e-3</td><td>5.045e-3</td><td>-2.002 5.604e-3</td></tr><tr><td>MCMC-stochvol</td><td>0.368</td><td>7.594e-3*</td><td>3.956e-2</td><td>6.421e-4</td><td>-0.909 1.511e-3</td></tr><tr><td>GPVOL</td><td>1.273</td><td>7.594e-3*</td><td>6.457e-1</td><td>4.142e-2</td><td>-2.052 5.739e-3</td></tr><tr><td>NAIVE</td><td>2.037e-1</td><td>8.423e-3</td><td>3.515e-3</td><td>2.708e-2</td><td>-0.918 7.459e-3</td></tr></table>
\*the same results obtained from AR(20) mean models
The newly proposed NSVM outperforms standard econometric models GARCH(1,1), EGARCH(1,1), GJR-GARCH(1,1,1) and some other variants as well as the MCMC-based model “stochvol” and the recent GP-based model “GPVOL”. Apart from the higher accuracy NSVM obtained, it provides us with the ability to simply generalise univariate time series analysis to multivariate cases by extending network dimensions and manipulating the covariance matrices. Furthermore, it allows us to implement and deploy a similar framework on other applications, for example signal processing and denoising. The shortcoming of NSVM comparing to GPVOL is that the training procedure is offline: for short-term prediction, the experiments have shown the accuracy, but for long-term forecasting, the parameters need retraining, which will be rather time consuming. The online algorithm for inference will be one of the work in the future.
Specifically, our NSVM outperforms GARCH(1,1) on 142 out of 162 stocks on the metric of NLL. In particular, NSVM obtains $- 2 . 1 1 1$ , $- 2 . 0 4 4$ , $- 2 . 6 0 9$ and $- 1 . 9 3 9$ on the stocks corresponding to Fig2(b), Fig 4(a), (b) and (c) respectively, each of which is better than the that of GARCH (0.3433, 0.589, 0.109 and 0.207 lower on NLL).
# 6 CONCLUSION
In this paper, a novel volatility model NSVM has been proposed for stochastic volatility estimation and forecast. We integrated statistical models and RNNs, leveraged the characteristics of each model, organised the dependences between random variables in the form of graphical models, implemented the mappings among variables and parameters through RNNs, and finally established a powerful stochastic recurrent model with universal approximation capability. The proposed architecture comprises a pair of complementary stochastic neural networks: the generative network and inference network. The former models the joint distribution of the stochastic volatility process with both observable and latent variables of interest; the latter provides with the approximate posterior i.e. an analytical approximation to the (intractable) conditional distribution of the latent variables given the observable ones. The parameters (and consequently the underlying distributions) are learned (and inferred) via variational inference, which maximises the lower bound for the marginal log-likelihood of the observable variables. Our NSVM has presented higher accuracy compared to GARCH(1,1), EGARCH(1,1) and GJR-GARCH(1,1,1) as well as GPVOL for volatility modelling and forecasting on synthetic data and real-world financial data. Future work on NSVM would be to incorporate well-established models such as ARMA/ARIMA and to investigate the modelling of seasonal time series and correlated sequences.
As we have known, for models that evolve explicitly in terms of the squares of the residuals $( e _ { t } ^ { 2 } =$ $( x _ { t } - \mu _ { t } ) ^ { 2 } )$ , e.g. GARCH, the multi-step-ahead forecasts have closed-form solutions, which means that those forecasts can be efficiently computed in a recursive fashion due to the linear formulation of the model and the exploitation of relation $E _ { t - 1 } [ e _ { t } ^ { 2 } ] = \sigma _ { t } ^ { 2 }$ .
On the other hand, for models that are not linear or do not explicitly evolve in terms of $e ^ { 2 }$ , e.g. EGARCH (linear but not evolve in terms of $e ^ { 2 }$ ), our NSVM (nonlinear and not evolve in terms of $e ^ { 2 }$ ), the closed-form solutions are absent and thus the analytical forecast is not available. We will instead use simulation-based forecast, which uses random number generator to simulate draws from the predicted distribution and build up a pre-specified number of paths of the variances at 1 step ahead. The draws are then averaged to produce the forecast of the next step. For n-step-ahead forecast, it requires n iterations of 1-step-ahead forecast to get there.
NSVM is designed as an end-to-end model for volatility estimation and forecast. It takes the price of stocks as input and outputs the distribution of the price at next step. It learns the dynamics using RNN, leading to an implicit, highly nonlinear formulation, where only simulation-based forecast is available. In order to obtain reasonably accurate forecasts, the number of draws should be relatively large, which will be very expensive for computation. Moreover, the number of draws will increase exponentially as the forecast horizon grows, so it will be infeasible to forecast several time steps ahead. We have planned to investigate the characteristics of NSVM’s long-horizontal forecasts and try to design a model specific sampling method for efficient evaluation in the future.
# REFERENCES
Torben G Andersen and Tim Bollerslev. Answering the skeptics: Yes, standard volatility models do provide accurate forecasts. International economic review, pp. 885–905, 1998.
Marco Avellaneda and Antonio Paras. Managing the volatility risk of portfolios of derivative securities: the lagrangian uncertain volatility model. Applied Mathematical Finance, 3(1):21–52, 1996.
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
Christopher M Bishop. Pattern recognition. Machine Learning, 128, 2006.
Tim Bollerslev. Generalized autoregressive conditional heteroskedasticity. Journal of econometrics, 31(3):307–327, 1986.
George EP Box, Gwilym M Jenkins, Gregory C Reinsel, and Greta M Ljung. Time series analysis: forecasting and control. John Wiley & Sons, 2015.
Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
Jan K Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. In Advances in Neural Information Processing Systems, pp. 577–585, 2015.
Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
John C Cox, Jonathan E Ingersoll Jr, and Stephen A Ross. A theory of the term structure of interest rates. Econometrica: Journal of the Econometric Society, pp. 385–407, 1985.
Timothy Dozat. Incorporating nesterov momentum into adam. 2015.
Robert F Engle. Autoregressive conditional heteroscedasticity with estimates of the variance of united kingdom inflation. Econometrica: Journal of the Econometric Society, pp. 987–1007, 1982.
Robert F Engle and Kenneth F Kroner. Multivariate simultaneous generalized arch. Econometric theory, 11(01):122–150, 1995.
Otto Fabius and Joost R van Amersfoort. Variational recurrent auto-encoders. arXiv preprint arXiv:1412.6581, 2014.
Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. arXiv preprint arXiv:1605.07571, 2016.
Lawrence R Glosten, Ravi Jagannathan, and David E Runkle. On the relation between the expected value and the volatility of the nominal excess return on stocks. The journal of finance, 48(5): 1779–1801, 1993.
Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In 2013 IEEE international conference on acoustics, speech and signal processing, pp. 6645–6649. IEEE, 2013.
Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
Barbara Hammer. On the approximation capability of recurrent neural networks. Neurocomputing, 31(1):107–123, 2000.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
Steven L Heston. A closed-form solution for options with stochastic volatility with applications to bond and currency options. Review of financial studies, 6(2):327–343, 1993.
Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
John C Hull. Options, futures, and other derivatives. Pearson Education India, 2006.
Matthew B Kennel, Reggie Brown, and Henry DI Abarbanel. Determining embedding dimension for phase-space reconstruction using a geometrical construction. Physical review A, 45(6):3403, 1992.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
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.
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
Daniel B Nelson. Conditional heteroskedasticity in asset returns: A new approach. Econometrica: Journal of the Econometric Society, pp. 347–370, 1991.
Ser-Huang Poon and Clive WJ Granger. Forecasting volatility in financial markets: A review. Journal of economic literature, 41(2):478–539, 2003.
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
Jurgen Schmidhuber. Deep learning in neural networks: An overview. ¨ Neural Networks, 61:85–117, 2015.
Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
Josef Stoer and Roland Bulirsch. Introduction to numerical analysis, volume 12. Springer Science & Business Media, 2013.
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016.
Yue Wu, Jose Miguel Hern ´ andez-Lobato, and Zoubin Ghahramani. Gaussian process volatility ´ model. In Advances in Neural Information Processing Systems, pp. 1044–1052, 2014.
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
# A COMPLEMENTARY DISCUSSIONS OF NSVM
In this appendix section we present detailed derivations of NSVM, specifically, the parameters learning and calibration, and covariance reparameterisation.
# A.1 LEARNING PARAMETERS / CALIBRATION
Given the observations $\boldsymbol { X }$ , the objective of learning is to maximise the marginal log-likelihood of $\boldsymbol { X }$ given $\Phi$ , where the posterior is involved. However, as we have discussed in the previous subsection, the true posterior is usually intractable, which means exact inference is difficult. Hence, approximate inference is applied instead of rather than exact inference by following (Kingma & Welling, 2013; Rezende et al., 2014). We represent the marginal log-likelihood of $\boldsymbol { X }$ in the following form:
$$\begin{array} { r l } & { \displaystyle \ln p _ { \Phi } ( \pmb X ) = \mathbb { E } _ { q _ { \Psi } ( Z | \pmb X ) } \Big [ \ln \frac { p _ { \Phi } ( \pmb X , Z ) } { p _ { \Phi } ( Z | \pmb X ) } \Big ] = \mathbb { E } _ { q _ { \Psi } ( Z | \pmb X ) } \Big [ \ln \frac { p _ { \Phi } ( \pmb X , Z ) } { q _ { \Psi } ( Z | \pmb X ) } \frac { q _ { \Psi } ( Z | \pmb X ) } { p _ { \Phi } ( Z | \pmb X ) } \Big ] } \\ & { \quad \quad \quad \quad \quad = \mathbb { E } _ { q _ { \Psi } ( Z | \pmb X ) } [ \ln p _ { \Phi } ( \pmb X , Z ) - \ln q _ { \Psi } ( Z | \pmb X ) ] + K L [ q _ { \Psi } ( Z | \pmb X ) | | p _ { \Phi } ( Z | \pmb X ) ] } \\ & { \quad \quad \quad \quad \geq \mathbb { E } _ { q _ { \Psi } ( Z | \pmb X ) } [ \ln p _ { \Phi } ( \pmb X , Z ) - \ln q _ { \Psi } ( Z | \pmb X ) ] \qquad ( \mathrm { a s } K L \geq 0 ) , } \end{array}$$
where the expectation term $\mathbb { E } _ { q _ { \Psi } ( Z | X ) } [ \ln p _ { \Phi } ( X , Z ) - \ln q _ { \Psi } ( Z | X ) ]$ is referred to as the variational lower bound $\mathcal { L } [ q ; X , \Phi , \Psi ]$ of the approximate posterior $q _ { \Psi } ( Z | X , \Psi )$ . The lower bound is essentially a functional with respect to distribution $q$ and parameterised by observations $\boldsymbol { X }$ and parameter sets $\Phi , \Psi$ of both generative and inference model. In theory, the marginal log-likelihood is maximised by optimisation on the lower bound $\mathcal { L } [ q ; X , \Phi , \Psi ]$ with respect to $\Phi$ and $\pmb { \psi }$ .
We apply the factorisations in Eqs. (10) and (19) to the integrand within expectation of Eq. (30):
$$\begin{array} { l } { \displaystyle \ln p _ { \Phi } ( X , Z ) - \ln q _ { \Psi } ( Z | X ) = \sum _ { t } \Big [ \ln \mathcal { N } ( x _ { t } ; \mu _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) , \Sigma _ { \Phi } ^ { x } ( x _ { < t } , z _ { \le t } ) ) } \\ { \displaystyle \qquad + \ln \mathcal { N } ( z _ { t } ; \mu _ { \Phi } ^ { z } ( z _ { < t } ) , \Sigma _ { \Phi } ^ { z } ( z _ { < t } ) ) - \ln \mathcal { N } ( z _ { t } ; \mu _ { \Psi } ^ { z } ( z _ { < t } , x _ { < t } ) , \tilde { \Sigma } _ { \Psi } ^ { z } ( z _ { < t } , x _ { < t } ) ) \Big ] . } \end{array}$$
As there is usually no closed-form solution for the expecation (Eq. (30)), we have to estimate the expectation by applying sampling methods to latent variable ${ \boldsymbol { z } } _ { t }$ through time in accordance with the causal dependences. We utilise the reparameterisation of ${ \boldsymbol { z } } _ { t }$ as shown in Eq. (22) such that we sample the corresponding auxiliary standard variable $\tilde { \epsilon } _ { t }$ rather than ${ \boldsymbol { z } } _ { t }$ itself and compute the value of ${ \boldsymbol { z } } _ { t }$ on the fly. This ensures that the gradient-based optimisation techniques are applicable as the reparameterisation isolates the model parameters of interest from the sampling procedure. By sampling $N$ sample paths, the estimator of the lower bound is defined as the average of paths:
$$\begin{array} { r l } & { \widehat { \mathcal { L } } = - \displaystyle \frac { 1 } { 2 N } \sum _ { t } \Big [ \ln \operatorname* { d e t } { \textstyle \Sigma _ { t } ^ { z } } + ( \tilde { \mu } _ { t } ^ { z } + \tilde { A } _ { t } ^ { z } \tilde { \epsilon } _ { t } ^ { z } - \mu _ { t } ^ { z } ) ^ { \top } ( { \textstyle \Sigma _ { t } ^ { z } } ) ^ { - 1 } ( \tilde { \mu } _ { t } ^ { z } + \tilde { A } _ { t } ^ { z } \tilde { \epsilon } _ { t } ^ { z } - \mu _ { t } ^ { z } ) } \\ & { \qquad + \ln \operatorname* { d e t } { \textstyle \Sigma _ { t } ^ { x } } + ( x _ { t } - \mu _ { t } ^ { x } ) ^ { \top } ( { \textstyle \Sigma _ { t } ^ { x } } ) ^ { - 1 } ( x _ { t } - \mu _ { t } ^ { x } ) - \ln \operatorname* { d e t } { \textstyle \tilde { \Sigma } _ { t } } \Big ] + \mathrm { c o n s t } , } \end{array}$$
where $\tilde { A } _ { t } ^ { z } ( \tilde { A } _ { t } ^ { z } ) ^ { \top } = \tilde { \Sigma } _ { t } ^ { z }$ and $\tilde { \epsilon } _ { t } ^ { z } \sim \mathcal { N } ( \mathbf { 0 } , I _ { z } )$ is parameter-independent and considered as constant when calculating derivatives.
# A.2 COVARIANCE PARAMETERISATION
As is known, it entails a computational complexity of $\mathcal { O } ( M ^ { 3 } )$ to maintain and update the full-size covariance $\pmb { \Sigma }$ with $M$ dimensions (Rezende et al., 2014). In the case of very high dimensions, the full-size covariance matrix would be too computationally expensive to afford. Hence, we use instead the covariance matrices with much fewer parameters for efficiency. The simplest setting is to use diagonal precision matrix (i.e. the inverse of covariance matrix) $\overrightharpoon { \mathbfcal { Z } } ^ { - 1 } = \overrightharpoon { \cal D }$ . However, it draws very strong restrictions on representation of the random variable of interest as the diagonal precision matrix (and thus diagonal covariance matrix) indicates independence among the dimensions. Therefore, the tradeoff becomes low-rank perturbation on diagonal matrix: $\pmb { \Sigma } ^ { - 1 } = \pmb { D } + \pmb { V V } ^ { \top }$ , where $V = \{ \pmb { v } _ { 1 } , \dots , \pmb { v } _ { K } \}$ denotes the perturbation while each ${ \pmb v } _ { k }$ is a $M$ -dimensional column vector.
The corresponding covariance matrix and its determinant is obtained using Woodbury identity and matrix determinant lemma:
$${ \begin{array} { r l } & { \qquad \Sigma = D ^ { - 1 } - D ^ { - 1 } V ( I + V ^ { \top } D ^ { - 1 } V ) ^ { - 1 } V ^ { \top } D ^ { - 1 } } \\ & { } \\ & { \ln \operatorname* { d e t } \Sigma = - \ln \operatorname* { d e t } { ( D + V V ^ { \top } ) } = - \ln \operatorname* { d e t } D - \ln \operatorname* { d e t } { ( I + V ^ { \top } D ^ { - 1 } V ) } } \end{array} }$$
To calculate the deviation $\pmb { A }$ for the factorisation of covariance matrix $\pmb { \Sigma } = \pmb { A } \pmb { A } ^ { \top }$ , we first consider the rank-1 perturbation where $K \ = \ 1$ . It follows that $V ~ = ~ v$ is a column vector, and $I + V ^ { \top } D ^ { - 1 } V \stackrel { \cdot } { = } 1 + v ^ { \top } D ^ { - 1 } v$ is a real number. A particular solution of $\pmb { A }$ is obtain:
$$A = D ^ { - \frac { 1 } { 2 } } - [ \gamma ^ { - 1 } ( 1 - \sqrt { \eta } ) ] D ^ { - 1 } v v ^ { \top } D ^ { - \frac { 1 } { 2 } }$$
where $\gamma = v ^ { \top } D ^ { - 1 } v$ , $\eta = ( 1 + \gamma ) ^ { - 1 }$ . The computational complexity involved here is merely $\mathcal { O } ( M )$ .
bserve that $\begin{array} { r } { V V ^ { \top } = \sum _ { k = 1 } ^ { K } { v _ { k } v _ { k } ^ { \top } } } \end{array}$ , the perturbation of rank $K$ is es ntially the superposition of $K$ $\pmb { A }$ provided to demonstrate the procedure of calculation. The computational complexity for rank- $K$ perturbation remains to be $\mathcal { O } ( M )$ given $K \ll M$ .
Algorithm 1 gives the detailed calculation scheme.
<table><tr><td>Algorithm1 Calculation of rank-K perturbation of precision matrices</td></tr><tr><td>Input: The original diagonal matrix D; The rank-K perturbation V = {U1,..., Uk}</td></tr><tr><td>Output: A such that the factorisation AAT = ∑= (D + VVT)-1 holds</td></tr><tr><td>1: A(0) = D-¹</td></tr><tr><td>2:i=0</td></tr><tr><td>3:while i<K_do 4: Y(i) =U)A(i))A)U(i)</td></tr><tr><td>5: n(i) = (1+Y())-1</td></tr><tr><td>6: A(i+1) =A(i)-[γ(i1(1-√n(a)]A(i)A)U(i)U(𝑖)A(𝑖) 7: A= A(K)</td></tr></table>
# B MORE CASE STUDIES
In this appendix section we add more case studies of NVSM performance on both synthetic data and real-world stock data.
NSVM obtains $- 2 . 0 4 4$ , $- 2 . 6 0 9$ and $- 1 . 9 3 9$ on the stocks corresponding to Fig 4(a), (b) and (c) respectively, each of which is better than the that of GARCH (0.589, 0.109 and 0.207 lower on NLL).
The reason of the drops in Fig 4(b) and (c) seems to be that NSVM has captured the jumps and drops of the stock price using its nonlinear dynamics and modelled the sudden changes as part of the trend: the estimated trend “mu” goes very close to the real observed price even around the jumps and drops (see the upper figure of Fig 4(b) and (c) around step 1300 and 1600). The residual (i.e. difference between the real value of observation and the trend of prediction) therefore becomes quite small, which lead to a lower volatility estimation.
On the other hand, for the baselines, we adopt AR as the trend model, which is a relatively simple linear model compared with the nonlinear NSVM. AR would not capture the sudden changes and leave those spikes in the residual; GARCH then took the residuals as input for volatility modelling, resulting in the spikes in volatility estimation.

(a) Synthetic time series prediction II. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The groundtruth data variance and the corresponding prediction from GARCH(1,1) and NSVM.
 Figure 3: A case study of synthetic time series prediction.
(b) Synthetic time series prediction IV. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The groundtruth data variance and the corresponding prediction from GARCH(1,1) and NSVM.
 (a) Real-world stock price prediction II. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The variance prediction from GARCH(1,1) and NSVM. The prediction of NSVM is more smooth and stable than that of GARCH(1,1), also yielding smaller NLL.
 (b) Real-world stock price prediction III. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The variance prediction from GARCH(1,1) and NSVM. The prediction of NSVM is more smooth and stable than that of GARCH(1,1), also yielding smaller NLL.
 Figure 4: A case study of real-world stock time series prediction.
(c) Real-world stock price prediction IV. (up) The data and the predicted $\mu ^ { x }$ and bounds $\mu ^ { x } \pm \sigma ^ { x }$ . (down) The variance prediction from GARCH(1,1) and NSVM. The prediction of NSVM is more smooth and stable than that of GARCH(1,1), also yielding smaller NLL.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398# HUMAN PERCEPTION IN COMPUTER VISION / CONFERENCE SUBMISSIONS
# Ron Dekel ∗
Department of Neurobiology Weizmann Institute of Science Rehovot, PA 7610001, Israel ron.dekel@weizmann.ac.il
# ABSTRACT
Computer vision has made remarkable progress in recent years. Deep neural network (DNN) models optimized to identify objects in images exhibit unprecedented task-trained accuracy and, remarkably, some generalization ability: new visual problems can now be solved more easily based on previous learning. Biological vision (learned in life and through evolution) is also accurate and generalpurpose. Is it possible that these different learning regimes converge to similar problem-dependent optimal computations? We therefore asked whether the human system-level computation of visual perception has DNN correlates and considered several anecdotal test cases. We found that perceptual sensitivity to image changes has DNN mid-computation correlates, while sensitivity to segmentation, crowding and shape has DNN end-computation correlates. Our results quantify the applicability of using DNN computation to estimate perceptual loss, and are consistent with the fascinating theoretical view that properties of human perception are a consequence of architecture-independent visual learning.
# 1 QUICK EXPERT SUMMARY
Considering the learned computation of ImageNet-trained DNNs, we find:
• Large computation changes for perceptually salient image changes (Figure 1). • Gestalt: segmentation, crowding, and shape interactions in computation (Figure 2). • Contrast constancy: bandpass transduction in first layers is later corrected (Figure 3).
These properties are reminiscent of human perception, perhaps because learned general-purpose classifiers (human and DNN) tend to converge.
# 2 INTRODUCTION
Deep neural networks (DNNs) are a class of computer learning algorithms that have become widely used in recent years (LeCun et al., 2015). By training with millions of examples, such models achieve unparalleled degrees of task-trained accuracy (Krizhevsky et al., 2012). This is not unprecedented on its own - steady progress has been made in computer vision for decades, and to some degree current designs are just scaled versions of long-known principles (Lecun et al., 1998). In previous models, however, only the design is general-purpose, while learning is mostly specific to the context of a trained task. Interestingly, for current DNNs trained to solve a large-scale image recognition problem (Russakovsky et al., 2014), the learned computation is useful as a building block for drastically different and untrained visual problems (Huh et al., 2016; Yosinski et al., 2014).
For example, orientation- and frequency-selective features (Gabor patches) can be considered general-purpose visual computations. Such features are routinely discovered by DNNs (Krizhevsky et al., 2012; Zeiler & Fergus, 2013), by other learning algorithms (Hinton & Salakhutdinov, 2006;
Lee et al., 2008; 2009; Olshausen & Field, 1997), and are extensively hard-coded in computer vision (Jain & Farrokhnia, 1991). Furthermore, a similar computation is believed to underlie the spatial response properties of visual neurons of diverse animal phyla (Carandini et al., 2005; DeAngelis et al., 1995; Hubel & Wiesel, 1968; Seelig & Jayaraman, 2013), and is evident in human visual perception (Campbell & Robson, 1968; Fogel & Sagi, 1989; Neri et al., 1999). This diversity culminates in satisfying theoretical arguments as to why Gabor-like features are so useful in general-purpose vision (Olshausen, 1996; Olshausen & Field, 1997).
As an extension, general-purpose computations are perhaps of universal use. For example, a dimensionality reduction transformation that optimally preserves recognition-relevant information may constitute an ideal computation for both DNN and animal. More formally, different learning algorithms with different physical implementations may converge to the same computation when similar (or sufficiently general) problems are solved near-optimally. Following this line of reasoning, DNN models with good general-purpose computations may be computationally similar to biological visual systems, even more so than less accurate and less general biologically plausible simulations (Kriegeskorte, 2015; Yamins & DiCarlo, 2016).
Related work seems to be consistent with computation convergence. First, different DNN training regimes seem to converge to a similar learned computation (Li et al., 2015; Zhou et al., 2014). Second, image representation may be similar in trained DNN and in biological visual systems. That is, when the same images are processed by DNN and by humans or monkeys, the final DNN computation stages are strong predictors of human fMRI and monkey electrophysiology data collected from visual areas V4 and IT (Cadieu et al., 2014; Khaligh-Razavi & Kriegeskorte, 2014; Yamins et al., 2014). Furthermore, more accurate DNN models exhibit stronger predictive power (Cadieu et al., 2014; Dubey & Agarwal, 2016; Yamins et al., 2014), and the final DNN computation stage is even a strong predictor of human-perceived shape discrimination (Kubilius et al., 2016). However, some caution is perhaps unavoidable, since measured similarity may be confounded with categorization consistency, view-invariance resilience, or similarity in the inherent difficulty of the tasks undergoing comparison. A complementary approach is to consider images that were produced by optimizing trained DNN-based perceptual metrics (Gatys et al., 2015a;b; Johnson et al., 2016; Ledig et al., 2016), which perhaps yields undeniable evidence of non-trivial computational similarity, although a more objective approach may be warranted.
Here, we quantify the similarity between human visual perception, as measured by psychophysical experiments, and individual computational stages (layers) in feed-forward DNNs trained on a large-scale image recognition problem (ImageNet LSVRC). Comparison is achieved by feeding the experimental image stimuli to the trained DNN and comparing a DNN metric (mean mutual information or mean absolute change) to perceptual data. The use of reduced (simplified and typically non-natural) stimuli ensures identical inherent task difficulty across compared categories and prevents confounding of categorization consistency with measured similarity. Perception, a systemlevel computation, may be influenced less by the architectural discrepancy (biology vs. DNN) than are neural recordings.
# 3 CORRELATE FOR IMAGE CHANGE SENSITIVITY
From a perceptual perspective, an image change of fixed size has different saliency depending on image context (Polat & Sagi, 1993). To investigate whether the computation in trained DNNs exhibits similar contextual modulation, we used the Local Image Masking Database (Alam et al., 2014), in which 1080 partially-overlapping images were subjected to different levels of the same random additive noise perturbation, and for each image, a psychophysical experiment determined the threshold noise level at which the added-noise image is discriminated from two noiseless copies at $7 5 \%$ (Figure 1a). Threshold is the objective function that is compared with an $L _ { 1 }$ -distance correlate in the DNN representation. The scale of measured threshold was:
$$2 0 \cdot \log _ { 1 0 } \left( \frac { \mathrm { s t d } \left( n o i s e \right) } { T } \right) ,$$
where std $( n o i s e )$ is the standard deviation of the additive noise, and $T$ is the mean image pixel value calculated over the region where the noise is added (i.e. image center).
 Figure 1: Predicting perturbation thresholds. a, For a fixed image perturbation, perceptual detection threshold (visualized by red arrow) depends on image context. b, Measured perceptual threshold is correlated with the average $L _ { 1 }$ change in DNN computation due to image perturbation (for DNN model VGG-19, image scale $= 1 0 0 \%$ ). c, Explained variability $( R ^ { 2 } )$ of perceptual threshold data when $L _ { 1 }$ change is based on isolated computational layers for different input image scales. Same VGG-19 model as in (b). X-axis labels: data refers to raw image pixel data, $\mathsf { c o n v ^ { * } } _ { - 1 }$ and ${ \mathsf { f c } } _ { - } *$ are the before-ReLU output of a convolution and a fully-connected operation, respectively, and prob is the output class label probabilities vector. d, Example images for whcih predicted threshold in b is much higher than perceptually measured (”Overshoot”, where perturbation saliency is better than predicted), or vise versa (”Undershoot”). Examples are considered from several perceptual threshold ranges $\pm 2 \mathrm { d B }$ of shown number).
The DNN correlate of perceptual threshold we used was the average $L _ { 1 }$ change in DNN computation between added-noise images and the original, noiseless image. Formally,
$$L _ { 1 } ^ { i , n } ( I ) = \left| \overline { { { a _ { i } \left( I + n o i s e \left( n \right) \right) } } } - a _ { i } \left( I \right) \right| ,$$
where $a _ { i } \left( X \right)$ is the activation value of neuron $i$ during the DNN feedforward pass for input image $X$ , and the inner average (denoted by bar) is taken over repetitions with random $n$ -sized noise (noise is introduced at random phase spectra in a fixed image location, an augmentation that follows the between-image randomization described by Alam et al., 2014; the number of repetitions was 10 or more). Unless otherwise specified, the final $L _ { 1 }$ prediction is $L _ { 1 } ^ { i , n }$ averaged across noise levels $( - 4 0$ to $2 5 { \mathrm { ~ d B } }$ with 5-dB intervals) and computational neurons (first within and then across computational stages). Using $L _ { 1 }$ averaged across noise levels as a correlate for the noise level of perceptual threshold is a simple approximation with minimal assumptions.
Results show that the $L _ { 1 }$ metric is correlated with the perceptual threshold for all tested DNN architectures (Figure 1b, 4a-c). In other words, higher values of the $L _ { 1 }$ metric (indicating larger changes in DNN computation due to image perturbation, consistent with higher perturbation saliency) are correlated with lower values of measured perceptual threshold (indicating that weaker noise levels are detectable, i.e. higher saliency once more).
Table 1: Prediction accuracy. Percent of linearly explained variability $( R ^ { 2 } )$ , absolute value of Spearman rank-order correlation coefficient (SROCC), and the root mean squared error of the linear prediction (RMSE) are presented for each prediction model. Note the measurement scale of the threshold data being predicted (Eq. 1). $( ^ { * } )$ Thresholds linearized through a logistic transform before prediction (see Larson & Chandler, 2010), possibly increasing but not decreasing measured predictive strength. $( ^ { * * } )$ Average of four similar alternatives.
<table><tr><td>Model</td><td>R²</td><td>SROCC</td><td>RMSE</td></tr><tr><td>Signal-noise ratio</td><td></td><td></td><td></td></tr><tr><td>Spectral change</td><td>.20 .25</td><td>.39</td><td>7.67</td></tr><tr><td>RMS contrast (Alam et al., 2014)</td><td>.27*</td><td>.61</td><td>7.42</td></tr><tr><td>L1 VGG-19 (50%)</td><td>.57</td><td>.46</td><td>1</td></tr><tr><td>L1 VGG-19 (66%)</td><td>.60</td><td>.77</td><td>5.57 5.42</td></tr><tr><td>L1 VGG-19 (100%)</td><td>.60</td><td>.79</td><td></td></tr><tr><td>Perceptual model** (Alam et al., 2014)</td><td>.60*</td><td>.79</td><td>5.40</td></tr><tr><td></td><td></td><td>.70</td><td>5.73</td></tr><tr><td>Inter-person (Alam et al., 2014)</td><td>.84*</td><td>.87</td><td>4.08</td></tr></table>
To quantify and compare predictive power, we considered the percent of linearly explained variability $( R ^ { 2 } )$ . For all tested DNN architectures, the prediction explains about $6 0 \%$ of the perceptual variability (Tables 1, 2; baselines at Tables 3-5), where inter-person similarity representing theoretical maximum is $84 \%$ (Alam et al., 2014). The DNN prediction is far more accurate than a prediction based on simple image statistical properties (e.g. RMS contrast), and is on par with a detailed perceptual model that relies on dozens of psychophysically collected parameters (Alam et al., 2014). The Spearmann correlation coefficient is much higher compared with the perceptual model (with an absolute SROCC value of about 0.79 compared with 0.70, Table 1), suggesting that the $L _ { 1 }$ metric gets the order right but not the scale. We did not compare these results with models that fit the experimental data (e.g. Alam et al., 2015; Liu & Allebach, 2016), since the $L _ { 1 }$ metric has no explicit parameters. Also, different DNN architectures exhibited high similarity in their predictions $\bar { R } ^ { 2 }$ of about 0.9, e.g. Figure 4d).
Prediction can also be made from isolated computational stages, instead of across all stages as before. This analysis shows that the predictive power peaks mid-computation across all tested image scales (Figure 1c). This peak is consistent with use of middle DNN layers to optimize perceptual metrics (Gatys et al., 2015a;b; Ledig et al., 2016), and is reminiscent of cases in which low- to mid-level vision is the performance limiting computation in the detection of at-threshold stimuli (Campbell & Robson, 1968; Del Cul et al., 2007).
Finally, considering the images for which the $L _ { 1 }$ -based prediction has a high error suggests a factor which causes a systematic inconsistency with perception (Figures 1d, 6). This factor may be related to the mean image luminance: by introducing noise perturbations according to the scale of Equation 1, a fixed noise size (in dB) corresponds to smaller pixel changes in dark compared with bright images. (Using this scales reflects an assumption of multiplicative rather than additive conservation; this assumption may be justified for the representation at the final but perhaps not the intermediate computational stages considering the log-linear contrast response discussed in Section 5). Another factor may the degree to which image content is identifiable.
The previous analysis suggested gross computational similarity between human perception and trained DNNs. Next, we aimed to extend the comparison to more interpretable properties of perception by considering more highly controlled designs. To this end, we considered cases in which a static background context modulates the difficulty of discriminating a foreground shape, despite no spatial overlap of foreground and background. This permits interpretation by considering the cause of the modulation.
We first consider segmentation, in which arrangement is better discriminated for arrays of consistently oriented lines compared with inconsistently oriented lines (Figure 2a) (Pinchuk-Yacobi et al., 2016). Crowding is considered next, where surround clutter that is similar to the discriminated target leads to deteriorated discrimination performance (Figure 2b) (Livne & Sagi, 2007). Last to be addressed is object superiority, in which a target line location is better discriminated when it is in a shape-forming layout (Figure 2c) (Weisstein & Harris, 1974). In this case, clutter is controlled by having the same fixed number of lines in context. To measure perceptual discrimination, these works introduced performance-limiting manipulations such as location jittering, brief presentation, and temporal masking. While different manipulations showed different measured values, order-of-difficulty was typically preserved. Here we changed all the original performance-limiting manipulations to location jittering (whole-shape or element-wise, see Section 8.4).
To quantify discrimination difficulty in DNNs, we measured the target-discriminative information of isolated neurons (where performance is limited by location jittering noise), then averaged across all neurons (first within and then across computational layer stages). Specifically, for each neuron, we measured the reduction in categorization uncertainty due to observation, termed mutual information (MI):
$$M I \left( A _ { i } ; C \right) = H \left( C \right) - H \left( C \vert A _ { i } \right) ,$$
where H stands for entropy, and $A _ { i }$ is a random variable for the value of neuron i when the DNN processes a random image from a category defined by the random variable C. For example, if a neuron gives a value in the range of 100.0 to 200.0 when the DNN processes images from category A, and 300.0 to 400.0 for category B, then the category is always known by observing the value, and so mutual information is high $\mathbf { M } \mathbf { I } { = } 1$ bits). On the other extreme, if the neuron has no discriminative task information, then ${ \bf M I } { = } 0$ bits. To measure MI, we quantized activations into eight equal-amount bins, and used 500 samples (repetitions having different location jittering noise) across categories. The motivation for this correlate is the assumption that the perceptual order-of-difficulty reflects the quantity of task-discriminative information in the representation.
Results show that, across hundreds of configurations (varying pattern element size, target location, jitter magnitude, and DNN architecture; see Section 8.4), the qualitative order of difficulty in terms of the DNN MI metric is consistent with the order of difficulty measured in human psychophysical experiments, for the conditions addressing segmentation and crowding (Figures 2d, 7; for baseline models see Figure 8). It is interesting to note that the increase in similarity develops gradually along different layer types in the DNN computation (i.e. not just pooling layers), and is accompanied by a gradual increase in the quantity of task-relevant information (Figure 2e-g). This indicates a link between task relevance and computational similarity for the tested conditions. Note that unlike the evident increase in isolated unit task information, the task information from all units combined decreases by definition along any computational hierarchy. An intuition for this result is that the total hidden information decreases, while more accessible per-unit information increases.
For shape formation, four out of six shapes consistently show order of difficulty like perception, and two shapes consistently do no (caricature at Figure 2h; actual data at Figure 9).
 Figure 2: Background context. a-c, Illustrations of reproduced discrimination stimuli for three psychophysical experiments (actual images used were white-on-black rather than black-on-white, and pattern size was smaller, see Figures 12-14). d, Number of configurations for which orderof-difficulty in discrimination is qualitatively consistency with perception according to a mutual information DNN metric. Configurations vary in pattern (element size, target location, and jitter magnitude; see Section 8.4) and in DNN architecture used (CaffeNet, GoogLeNet, VGG-19, and ResNet-152). DNN metric is the average across neurons of the isolated neuron target-discriminative information (averaged first within, and then across computational layer stages), where performance is limited by location jittering (e.g. evident jitter in illustrations). e-g, The value of the MI metric across computational layers of model VGG-19 for a typical pattern configuration. The six ”hard” (gray) lines in Shape MI correspond to six different layouts (see Section 8.4.3). Analysis shows that for isolated computation stages, similarity to perception is evident only at the final DNN computation stages. h, A caricature summarizing the similarity and discrepancy of perception and the MI-based DNN prediction for Shape (see Figure 9).
# 5 CORRELATE FOR CONTRAST SENSITIVITY
A cornerstone of biological vision research is the use of sine gratings at different frequencies, orientations, and contrasts (Campbell & Robson, 1968). Notable are results showing that the lowest perceivable contrast in human perception depends on frequency. Specifically, high spatial frequencies are attenuated by the optics of the eye, and low spatial frequencies are believed to be attenuated due to processing inefficiencies (Watson & Ahumada, 2008), so that the lowest perceivable contrast is found at intermediate frequencies. (To appreciate this yourself, examine Figure 3a). Thus, for low-contrast gratings, the physical quantity of contrast is not perceived correctly: it is not preserved across spatial frequencies. Interestingly, this is corrected for gratings of higher contrasts, for which perceived contrast is more constant across spatial frequencies (Georgeson & Sullivan, 1975).
The DNN correlate we considered is the mean absolute change in DNN representation between a gray image and sinusoidal gratings, at all combinations of spatial frequency and contrast. Formally, for neurons in a given layer, we measured:
$$L _ { 1 } ( c o n t r a s t , f r e q u e n c y ) = \frac { 1 } { N _ { n e u r o n s } } \sum _ { i = 1 } ^ { N _ { n e u r o n s } } \left| \overline { { a _ { i } \left( c o n t r a s t , f r e q u e n c y \right) } } - a _ { i } \left( 0 , 0 \right) \right| ,$$
where $a _ { i }$ (contrast, frequency) is the average activation value of neuron $i$ to 250 sine images (random orientation, random phase), $a _ { i } \left( 0 , 0 \right)$ is the response to a blank (gray) image, and $N _ { n }$ eurons is the number of neurons in the layer. This measure reflects the overall change in response vs. the gray image.
Results show a bandpass response for low-contrast gratings (blue lines strongly modulated by frequency, Figures 3, 10), and what appears to be a mostly constant response at high contrast for end-computation layers (red lines appear more invariant to frequency), in accordance with perception.
We next aimed to compare these results with perception. Data from human experiments is generally iso-output (i.e. for a pre-set output, such as $7 5 \%$ detection accuracy, the input is varied to find the value which produce the preset output). However, the DNN measurements here are iso-input (i.e. for a fixed input contrast the $L _ { 1 }$ is measured). As such, human data should be compared to the interpoalted inverse of DNN measurements. Specifically, for a set output value, the interpolated contrast value which produce the output is found for every frequency (Figure 11). This analysis permits quantifying the similarity of iso-output curves for human and DNN, measured here as the percent of log-Contrast variability in human measurements which is explained by the DNN predictions. This showed a high explained variability at the end computation stage (prob layer, $\mathbf { \dot { \mathit { R } } ^ { 2 } = 9 4 \% }$ , but importantly, a similarly high value at the first computational stage (conv1 1 layer, $R ^ { 2 } = 9 6 \%$ ). Intiutively, while the ”internal representation” variability in terms of $L _ { 1 }$ is small, the iso-output number-of-input-contrast-cahnges variability is still high. For example. for the prob layer, about the same $L _ { 1 }$ is measured for (Contrast $^ { - 1 }$ ,freq $= 7 5$ ) and for (Contras ${ = } 0 . 1 8$ ,freq $= 1 2$ ).
An interesting, unexpected observation is that the logarithmically spaced contrast inputs are linearly spaced at the end-computation layers. That is, the average change in DNN representation scales logarithmically with the size of input change. This can be quantified by the correlation of output $L _ { 1 }$ with log Contrast input, which showed $R ^ { 2 } = 9 8 \%$ (averaged across spatial frequencies) for prob, while much lower values were observed for early and middle layers (up to layer fc7). The same computation when scrambling the learned parameters of the model showed $R ^ { 2 } = 6 0 \%$ . Because the degree of log-linearity observed was extremely high, it may be an important emergent property of the learned DNN computation, which may deserve further investigation. However, this property is only reminiscent and not immediately consistent with the perceptual power-law scaling (Gottesman et al., 1981).
 Figure 3: Contrast sensitivity. a. Perceived contrast is strongly affected by spatial frequency at low contrast, but less so at high contrast (which preserves the physical quantity of contrast and thus termed constancy). b. The $L _ { 1 }$ change in VGG-19 representation between a gray image and images depicting sinusoidal gratings at each combination of sine spatial frequency $\mathbf { \dot { x } }$ -axis) and contrast (color) (random orientation, random phase), considering the raw image pixel data representation (data), the before-ReLU output of the first convolutional layer representation (conv1 1), the output of the last fully-connected layer representation (fc8), and the output class label probabilities representation (prob).
# 6 DISCUSSION
# 6.1 HUMAN PERCEPTION IN COMPUTER VISION
It may be tempting to believe that what we see is the result of a simple transformation of visual input. Centuries of psychophysics have, however, revealed complex properties in perception, by crafting stimuli that isolate different perceptual properties. In our study, we used the same stimuli to investigate the learned properties of deep neural networks (DNNs), which are the leading computer vision algorithms to date (LeCun et al., 2015).
The DNNs we used were trained in a supervised fashion to assign labels to input images. To some degree, this task resembles the simple verbal explanations given to children by their parents. Since human perception is obviously much richer than the simple external supervision provided, we were not surprised to find that the best correlate for perceptual saliency of image changes is a part of the DNN computation that is only supervised indirectly (i.e. the mid-computation stage). This similarity is so strong, that even with no fine-tuning to human perception, the DNN metric is competitively accurate, even compared with a direct model of perception.
This strong, quantifiable similarity to a gross aspect of perception may, however, reflect a mix of similarities and discrepancies in different perceptual properties. To address isolated perceptual effects, we considered experiments that manipulate a spatial interaction, where the difficulty of discriminating a foreground target is modulated by a background context. Results showed modulation of DNN target diagnostic, isolated unit information, consistent with the modulation found in perceptual discrimination. This was shown for contextual interactions reflecting grouping/segmentation (Harris et al., 2015), crowding/clutter (Livne & Sagi, 2007; Pelli et al., 2004), and shape superiority (Weisstein & Harris, 1974). DNN similarity to these groupings/gestalt phenomena appeared at the end-computation stages.
No less interesting, are the cases in which there is no similarity. For example, perceptual effects related to 3D (Erdogan & Jacobs, 2016) and symmetry (Pramod & Arun, 2016) do not appear to have a strong correlate in the DNN computation. Indeed, it may be interesting to investigate the influence of visual experience in these cases. And, equally important, similarity should be considered in terms of specific perceptual properties rather than as a general statement.
# 6.2 RECURRENT VS. FEEDFORWARD CONNECTIVITY
In the human hierarchy of visual processing areas, information is believed to be processed in a feedforward sweep, followed by recurrent processing loops (top-down and lateral) (Lamme & Roelfsema, 2000). Thus, for example, the early visual areas can perform deep computations. Since mapping from visual areas to DNN computational layers is not simple, it will not be considered here. (Note that ResNet connectivity is perhaps reminiscent of unrolled recurrent processing).
Interestingly, debate is ongoing about the degree to which visual perception is dependent on recurrent connectivity (Fabre-Thorpe et al., 1998; Hung et al., 2005): recurrent representations are obviously richer, but feedforward computations converge much faster. An implicit question here regarding the extent of feasible feed-forward representations is, perhaps: Can contour segmentation, contextual influences, and complex shapes be learned? Based on the results reported here for feedforward DNNs, a feedforward representation may seem sufficient. However, the extent to which this is true may be very limited. In this study we used small images with a small number of lines, while effects such as contour integration seem to take place even in very large configurations (Field et al., 1993). Such scaling seems more likely in a recurrent implementation. As such, a reasonable hypothesis may be that the full extent of contextual influence is only realizable with recurrence, while feedforward DNNs learn a limited version by converging towards a useful computation.
# 6.3 IMPLICATIONS AND FUTURE WORK
# 6.3.1 USE IN BRAIN MODELING
The use of DNNs in modeling of visual perception (or of biological visual systems in general) is subject to a tradeoff between accuracy and biological plausibility. In terms of architecture, other deep models better approximate our current understanding of the visual system (Riesenhuber &
Poggio, 1999; Serre, 2014). However, the computation in trained DNN models is quite generalpurpose (Huh et al., 2016; Yosinski et al., 2014) and offers unparalleled accuracy in recognition tasks (LeCun et al., 2015). Since visual computations are, to some degree, task- rather than architecturedependent, an accurate and general-purpose DNN model may better resemble biological processing than less accurate biologically plausible ones (Kriegeskorte, 2015; Yamins & DiCarlo, 2016). We support this view by considering a controlled condition in which similarity is not confounded with task difficulty or categorization consistency.
# 6.3.2 USE IN PSYCHOPHYSICS
Our results imply that trained DNN models have good predictive value for outcomes of psychophysical experiments, permitting a zero-cost first-order approximation. Note, however, that the scope of such simulations may be limited, since learning (Sagi, 2011) and adaptation (Webster, 2011) were not considered here.
Another fascinating option is the formation of hypotheses in terms of mathematically differentiable trained-DNN constraints, whereby it is possible to efficiently solve for the visual stimuli that optimally dissociate the hypotheses (see Gatys et al. 2015a;b; Mordvintsev et al. 2015 and note Goodfellow et al. 2014; Szegedy et al. 2013). The conclusions drawn from such stimuli can be independent of the theoretical assumptions about the generating process (for example, creating new visual illusions that can be seen regardless of how they were created).
# 6.3.3 USE IN ENGINEERING (A PERCEPTUAL LOSS METRIC)
As proposed previously (Dosovitskiy & Brox, 2016; Johnson et al., 2016; Ledig et al., 2016), the saliency of small image changes can be estimated as the representational distance in trained DNNs. Here, we quantified this approach by relying on data from a controlled psychophysical experiment (Alam et al., 2014). We found the metric to be far superior to simple image statistical properties, and on par with a detailed perceptual model (Alam et al., 2014). This metric can be useful in image compression, whereby optimizing degradation across image sub-patches by comparing perceptual loss may minimize visual artifacts and content loss.
# ACKNOWLEDGMENTS
We thank Yoram Bonneh for his valuable questions which led to much of this work.
# REFERENCES
Md Mushfiqul Alam, Kedarnath P Vilankar, David J Field, and Damon M Chandler. Local masking in natural images: A database and analysis. Journal of vision, 14(8):22–, jan 2014. ISSN 1534- 7362. doi: 10.1167/14.8.22.
Md Mushfiqul Alam, Pranita Patil, Martin T Hagan, and Damon M Chandler. A computational model for predicting local distortion visibility via convolutional neural network trainedon natural scenes. In Image Processing (ICIP), 2015 IEEE International Conference on, pp. 3967–3971. IEEE, 2015.
Charles F Cadieu, Ha Hong, Daniel L K Yamins, Nicolas Pinto, Diego Ardila, Ethan A Solomon, Najib J Majaj, and James J DiCarlo. Deep neural networks rival the representation of primate IT cortex for core visual object recognition. PLoS computational biology, 10(12):e1003963, dec 2014. ISSN 1553-7358. doi: 10.1371/journal.pcbi.1003963.
Fergus W Campbell and J G Robson. Application of Fourier analysis to the visibility of gratings. The Journal of physiology, 197(3):551, 1968.
Matteo Carandini, Jonathan B Demb, Valerio Mante, David J Tolhurst, Yang Dan, Bruno A Olshausen, Jack L Gallant, and Nicole C Rust. Do we know what the early visual system does? The Journal of Neuroscience, 25(46):10577–97, nov 2005. ISSN 1529-2401. doi: 10.1523/JNEUROSCI.3726-05.2005.
Gregory C DeAngelis, Izumi Ohzawa, and Ralph D Freeman. Receptive-field dynamics in the central visual pathways. Trends in neurosciences, 18(10):451–458, 1995. ISSN 0166-2236.
Antoine Del Cul, Sylvain Baillet, and Stanislas Dehaene. Brain dynamics underlying the nonlinear threshold for access to consciousness. PLoS Biol, 5(10):e260, 2007. ISSN 1545-7885.
Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. arXiv preprint arXiv:1602.02644, 2016.
Abhimanyu Dubey and Sumeet Agarwal. Examining Representational Similarity in ConvNets and the Primate Visual Cortex. arXiv preprint arXiv:1609.03529, 2016.
Goker Erdogan and Robert A Jacobs. A 3D shape inference model matches human visual object similarity judgments better than deep convolutional neural networks. In Proceedings of the 38th Annual Conference of the Cognitive Science Society. Cognitive Science Society Austin, TX, 2016.
Michele Fabre-Thorpe, Ghislaine Richard, and Simon J Thorpe. Rapid categorization of natural \` images by rhesus monkeys. Neuroreport, 9(2):303–308, 1998. ISSN 0959-4965.
David J Field, Anthony Hayes, and Robert F Hess. Contour integration by the human visual system: evidence for a local association field. Vision research, 33(2):173–193, 1993. ISSN 0042-6989.
Itzhak Fogel and Dov Sagi. Gabor filters as texture discriminator. Biological cybernetics, 61(2): 103–113, 1989. ISSN 0340-1200.
Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. A Neural Algorithm of Artistic Style. aug 2015a.
Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Texture synthesis and the controlled generation of natural stimuli using convolutional neural networks. may 2015b.
M A Georgeson and G D Sullivan. Contrast constancy: deblurring in human vision by spatial frequency channels. The Journal of Physiology, 252(3):627–656, 1975. ISSN 1469-7793.
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
Jon Gottesman, Gary S Rubin, and Gordon E Legge. A power law for perceived contrast in human vision. Vision research, 21(6):791–799, 1981. ISSN 0042-6989.
Hila Harris, Noga Pinchuk-Yacobi, and Dov Sagi. Target selective tilt-after effect during texture learning. Journal of vision, 15(12):1134, 2015.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. dec 2015.
Hinton and Salakhutdinov. Reducing the dimensionality of data with neural networks. Science (New York, N.Y.), 313(5786):504–7, jul 2006. ISSN 1095-9203. doi: 10.1126/science.1127647.
D. H. Hubel and T. N. Wiesel. Receptive fields and functional architecture of monkey striate cortex. The Journal of Physiology, 195(1):215–243, mar 1968. ISSN 00223751. doi: 10.1113/jphysiol. 1968.sp008455.
Minyoung Huh, Pulkit Agrawal, and Alexei A. Efros. What makes ImageNet good for transfer learning? aug 2016.
Chou P Hung, Gabriel Kreiman, Tomaso Poggio, and James J DiCarlo. Fast readout of object identity from macaque inferior temporal cortex. Science, 310(5749):863–866, 2005. ISSN 0036- 8075.
Anil K Jain and Farshid Farrokhnia. Unsupervised texture segmentation using Gabor filters. Pattern recognition, 24(12):1167–1186, 1991. ISSN 0031-3203.
Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe. In Proceedings of the ACM International Conference on Multimedia - MM ’14, pp. 675–678, New York, New York, USA, nov 2014. ACM Press. ISBN 9781450330633. doi: 10.1145/2647868.2654889.
Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. arXiv preprint arXiv:1603.08155, 2016.
A. Karni and D. Sagi. Where practice makes perfect in texture discrimination: evidence for primary visual cortex plasticity. Proceedings of the National Academy of Sciences, 88(11):4966–4970, jun 1991. ISSN 0027-8424. doi: 10.1073/pnas.88.11.4966.
Seyed-Mahdi Khaligh-Razavi and Nikolaus Kriegeskorte. Deep Supervised, but Not Unsupervised, Models May Explain IT Cortical Representation. PLoS Computational Biology, 10(11): e1003915, nov 2014. ISSN 1553-7358. doi: 10.1371/journal.pcbi.1003915.
Nikolaus Kriegeskorte. Deep neural networks: A new framework for modeling biological vision and brain information processing. Annual Review of Vision Science, 1:417–446, 2015. ISSN 2374-4642.
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.
Jonas Kubilius, Stefania Bracci, and Hans P Op de Beeck. Deep Neural Networks as a Computational Model for Human Shape Sensitivity. PLoS Comput Biol, 12(4):e1004896, 2016. ISSN 1553-7358.
Victor A.F. Lamme and Pieter R. Roelfsema. The distinct modes of vision offered by feedforward and recurrent processing. Trends in Neurosciences, 23(11):571–579, nov 2000. ISSN 01662236. doi: 10.1016/S0166-2236(00)01657-X.
Eric C Larson and Damon M Chandler. Most apparent distortion: full-reference image quality assessment and the role of strategy. Journal of Electronic Imaging, 19(1):11006, 2010. ISSN 1017-9909.
Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. ISSN 00189219. doi: 10.1109/5.726791.
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, may 2015. ISSN 0028-0836. doi: 10.1038/nature14539.
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network. sep 2016.
Honglak Lee, Chaitanya Ekanadham, and Andrew Y. Ng. Sparse deep belief net model for visual area V2. In Advances in Neural Information Processing Systems, pp. 873–880, 2008.
Honglak Lee, Roger Grosse, Rajesh Ranganath, and Andrew Y. Ng. Convolutional deep belief networks for scalable unsupervised learning of hierarchical representations. In Proceedings of the 26th Annual International Conference on Machine Learning - ICML ’09, pp. 1–8, New York, New York, USA, jun 2009. ACM Press. ISBN 9781605585161. doi: 10.1145/1553374.1553453.
Yixuan Li, Jason Yosinski, Jeff Clune, Hod Lipson, and John Hopcroft. Convergent Learning: Do different neural networks learn the same representations? arXiv preprint arXiv:1511.07543, 2015.
Yucheng Liu and Jan P. Allebach. Near-threshold perceptual distortion prediction based on optimal structure classification. In 2016 IEEE International Conference on Image Processing (ICIP), pp. 106–110. IEEE, sep 2016. ISBN 978-1-4673-9961-6. doi: 10.1109/ICIP.2016.7532328.
Tomer Livne and Dov Sagi. Configuration influence on crowding. Journal of Vision, 7(2):4, 2007. ISSN 1534-7362.
Alexander Mordvintsev, Christopher Olah, and Mike Tyka. Inceptionism: Going deeper into neural networks. Google Research Blog. Retrieved June, 20, 2015.
Peter Neri, Andrew J Parker, and Colin Blakemore. Probing the human stereoscopic system with reverse correlation. Nature, 401(6754):695–698, 1999. ISSN 0028-0836.
Bruno A Olshausen. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583):607–609, 1996. ISSN 0028-0836.
Bruno A. Olshausen and David J. Field. Sparse coding with an overcomplete basis set: A strategy employed by V1? Vision Research, 37(23):3311–3325, dec 1997. ISSN 00426989. doi: 10.1016/ S0042-6989(97)00169-7.
Denis G Pelli, Melanie Palomares, and Najib J Majaj. Crowding is unlike ordinary masking: Distinguishing feature integration from detection. Journal of vision, 4(12):12, 2004. ISSN 1534-7362.
Noga Pinchuk-Yacobi, Ron Dekel, and Dov Sagi. Expectation and the tilt aftereffect. Journal of vision, 15(12):39, sep 2015. ISSN 1534-7362. doi: 10.1167/15.12.39.
Noga Pinchuk-Yacobi, Hila Harris, and Dov Sagi. Target-selective tilt aftereffect during texture learning. Vision research, 124:44–51, 2016. ISSN 0042-6989.
U Polat and D Sagi. Lateral interactions between spatial channels: suppression and facilitation revealed by lateral masking experiments. Vision research, 33(7):993–9, may 1993. ISSN 0042- 6989.
R T Pramod and S P Arun. Do computational models differ systematically from human object perception? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1601–1609, 2016.
Maximilian Riesenhuber and Tomaso Poggio. Hierarchical models of object recognition in cortex. Nature neuroscience, 2(11):1019–1025, 1999.
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. sep 2014.
Dov Sagi. Perceptual learning in vision research. Vision research, 51(13):1552–1566, 2011. ISSN 0042-6989.
Johannes D Seelig and Vivek Jayaraman. Feature detection and orientation tuning in the Drosophila central complex. Nature, 503(7475):262–266, 2013. ISSN 0028-0836.
Thomas Serre. Hierarchical Models of the Visual System. In Encyclopedia of Computational Neuroscience, pp. 1–12. Springer, 2014. ISBN 1461473209.
Eero P Simoncelli and William T Freeman. The steerable pyramid: a flexible architecture for multiscale derivative computation. In ICIP (3), pp. 444–447, 1995.
Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. sep 2014.
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going Deeper with Convolutions. sep 2014.
Andrea Vedaldi and Karel Lenc. Matconvnet: Convolutional neural networks for matlab. In Proceedings of the 23rd ACM international conference on Multimedia, pp. 689–692. ACM, 2015. ISBN 1450334598.
Andrew B Watson and Albert J Ahumada. Predicting visual acuity from wavefront aberrations. Journal of vision, 8(4):17.1–19, jan 2008. ISSN 1534-7362. doi: 10.1167/8.4.17.
Michael A Webster. Adaptation and visual coding. Journal of vision, 11(5), jan 2011. ISSN 1534- 7362.
N. Weisstein and C. S. Harris. Visual Detection of Line Segments: An Object-Superiority Effect. Science, 186(4165):752–755, nov 1974. ISSN 0036-8075. doi: 10.1126/science.186.4165.752.
Daniel L K Yamins and James J DiCarlo. Using goal-driven deep learning models to understand sensory cortex. Nature neuroscience, 19(3):356–365, 2016. ISSN 1097-6256.
Daniel L K Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619–8624, 2014. ISSN 0027-8424.
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.
Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. nov 2013.
Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object Detectors Emerge in Deep Scene CNNs. pp. 12, dec 2014.
 Figure 4: Predicting perceptual sensitivity to image changes (following Figure 1). a-c, The $L _ { 1 }$ change in CaffeNet, GoogLeNet, and ResNet-152 DNN architectures as a function of perceptual threshold. d, The $L _ { 1 }$ change in GoogLeNet as a function of the $L _ { 1 }$ change in VGG-19.
 Figure 5: Prediction accuracy as a function of computational stage. a, Predicting perceptual sensitivity for model VGG-19 using the best single kernel (i.e. using one fitting parameter, no cross validation), vs. the standard $L _ { 1 }$ metric (reproduced from Figure 1). b, For non-branch computational stages of model ResNet-152.
Table 2: Accuracy of perceptual sensitivity prediction and task-trained ImageNet center-crop top-1 validation accuracy for different DNN models (following Table 1 from which third row is reproduced; used scale: $100 \%$ ). The quality of prediction for ResNet-152 improves dramatically if only the first tens of layers are considered (see Figure 5b).
<table><tr><td>Model</td><td>R²</td><td>SROCC</td><td>RMSE</td><td>Recognition accuracy</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CaffeNet</td><td>.59</td><td>.78</td><td>5.44</td><td>56%</td></tr><tr><td>GoogLeNet</td><td>.59</td><td>.79</td><td>5.45 5.40</td><td>66%</td></tr><tr><td>VGG-19</td><td>.60</td><td>.79</td><td>5.82</td><td>70%</td></tr><tr><td>ResNet-152</td><td>.53</td><td>.74</td><td></td><td>75%</td></tr></table>
Table 3: Accuracy of perceptual sensitivity prediction for baseline models (see Section 8.2; used scale: $100 \%$ ).
<table><tr><td>Model</td><td>R²</td><td>SROCC</td><td>RMSE</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>VGG-19, scrambled weights</td><td>.18</td><td>.39</td><td>7.76</td></tr><tr><td>Gabor filter bank</td><td>.32</td><td>.12</td><td>8.03</td></tr><tr><td>Steerable-pyramid filter bank</td><td>.37</td><td>.15</td><td>7.91</td></tr></table>
Table 4: Accuracy of perceptual sensitivity prediction during CaffeNet model standard training (used scale: $100 \%$ ). Last row reproduced from Table 2.
<table><tr><td>Model</td><td>R²</td><td>SROCC</td><td>RMSE</td><td>Recognition accuracy</td></tr><tr><td>CaffeNetiter1</td><td></td><td></td><td>6.30</td><td></td></tr><tr><td>CaffeNetiter50K</td><td>.46 .59</td><td>.67 .79</td><td>5.43</td><td>0% 37%</td></tr><tr><td>CaffeNetiter100K</td><td>.60</td><td>.79</td><td>5.41</td><td>39%</td></tr><tr><td>CaffeNetiter150K</td><td>.60</td><td>.78</td><td>5.43</td><td>53%</td></tr><tr><td>CaffeNetiter200K</td><td>.59</td><td>.78</td><td>5.45</td><td>54%</td></tr><tr><td>CaffeNetiter250K</td><td>.59</td><td>.78</td><td>5.43</td><td>56%</td></tr><tr><td>CaffeNetiter300K</td><td>.59</td><td>.78</td><td>5.44</td><td>56%</td></tr><tr><td>CaffeNetiter310K</td><td>.59</td><td>.78</td><td>5.44</td><td>56%</td></tr></table>
Table 5: Robustness of perceptual sensitivity prediction for varying prediction parameters for model VGG-19. First three rows reproduced from Table 1. Measurements for the lower noise range of -60:-40 dB were omitted by mistake.
<table><tr><td>Scale</td><td>Metric</td><td>Augmentation</td><td>Noise range</td><td>R²</td><td>SROCC</td><td>RMSE</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>100%</td><td>L1</td><td>noise phase</td><td>-40:25 dB</td><td>.60</td><td>.79</td><td>5.40</td></tr><tr><td>66%</td><td>L1</td><td>noise phase</td><td>-40:25 dB</td><td>.60</td><td>.79</td><td>5.42</td></tr><tr><td>50%</td><td>L1</td><td>noise phase</td><td>-40:25 dB</td><td>.57</td><td>.77</td><td>5.57</td></tr><tr><td>100%</td><td>L2</td><td>noise phase</td><td>-40:25 dB</td><td>.62</td><td>.80</td><td>5.29</td></tr><tr><td>100%</td><td>L1</td><td>None</td><td>-40:25 dB</td><td>.58</td><td>.77</td><td>5.55</td></tr><tr><td>100%</td><td>L1</td><td>noise phase</td><td>-20:25 dB</td><td>.59</td><td>.78</td><td>5.46</td></tr><tr><td>100%</td><td>L1</td><td>noise phase</td><td>-40:5 dB</td><td>.59</td><td>.79</td><td>5.43</td></tr></table>
Table 6: Background context for Shape. Shown is the Spearmann correlation coefficient (SROCC) of perceptual data vs. model-based MI prediction across shapes (i.e. considering all shapes rather than only Easy vs. Hard; note that the original robust finding the superiority of the Easy shape). Perceptual data from Weisstein & Harris (1974), where ”Day 1” and ”Days $2 { - } 4 ^ { \dag }$ (averaged) are for the reduced-masking condition depicted in their Figure 3.)
<table><tr><td>Model</td><td></td><td>Day 1 Days 2-4</td><td>Masked</td></tr><tr><td>VGG-19</td><td>.36</td><td></td><td>.15</td></tr><tr><td>GoogLeNet</td><td>.31</td><td>.37 .22</td><td>.16</td></tr><tr><td>MRSA-152</td><td>.26</td><td>.26</td><td>.11</td></tr><tr><td>CaffeNet iter 1</td><td>.32</td><td></td><td>.39</td></tr><tr><td>CaffeNet iter 50K</td><td>.15</td><td>.29</td><td></td></tr><tr><td>CaffeNetiter310K</td><td>.16</td><td>.19</td><td>.16 .18</td></tr><tr><td></td><td>.26</td><td>.12</td><td>.48</td></tr><tr><td>Gabor Decomposition Steerable Pyramid</td><td>.24</td><td>.27 .32</td><td>.25</td></tr></table>
 Figure 6: Images where predicted threshold is too high (”Overshoot”, where perturbation saliency is better than predicted) or too low (”Undershoot”), considered from several perceptual threshold ranges $\pm 2$ dB of shown number). Some images are reproduced from Figure 1.
 Figure 7: Background context for different DNN models (following figure 2).
 Figure 8: Background context for baseline DNN models (following figure 2). ”CaffeNet iter 310K” is reproduced from Figure 7.
 Figure 9: Background context for Shape. Shown for each model is the measured MI for the six ”Hard” shapes as a function of the MI for the ”Easy” shape. The last panel shows an analagous comparison measured in human subjects by Weisstein & Harris (1974). A data point which lies below the dashed diagonal indicates a configuration for which discriminating line location is easier for the Easy shape compared with the relevant Hard shape.
 Figure 10: Contrast sensitivity (following Figure 3) for DNN architectures CaffeNet, GoogLeNet, and ResNet-152.
 Figure 11: Comparison of contrast sensitivity. Shown are iso-output curves, for which perceived contrast is the same (Human), or for which the $L _ { 1 }$ change relative to a gray image is the same (DNN model VGG-19). To obtain a correspondence between human frequency values (given in cycles per degree of visual field) to DNN frequency values (given in cycles per image), a scaling was chosen such that the minima of the blue curve is given at the same frequency value. Human data is for subject M.A.G. as measured by Georgeson & Sullivan (1975).
# 8 APPENDIX: EXPERIMENTAL SETUP
# 8.1 DNN MODELS
To collect DNN computation snapshots, we used MATLAB with MatConvNet version 1.0-beta20 (Vedaldi & Lenc, 2015). All MATLAB code will be made available upon acceptance of this manuscript. The pre-trained DNN models we have used are: CaffeNet (which is a variant of AlexNet provided in Caffe, Jia et al., 2014), GoogLeNet (Szegedy et al., 2014), VGG-19 (Simonyan & Zisserman, 2014), and ResNet-152 (He et al., 2015). The models were trained on the same ImageNet LSVRC. The CaffeNet model was trained using Caffe with the default ImageNet training parameters (stopping at iteration 310, 000) and imported into MatConvNet. For the GoogLeNet model, we used the imported pre-trained reference-Caffe implementation. For VGG-19 and ResNet-152, we used the imported pre-trained original versions. In all experiments input image size was $2 2 4 \times 2 2 4$ or $2 2 7 \times 2 2 7$ .
# 8.2 BASELINE MODELS
As baselines to compare with pre-trained DNN models, we consider: (a) a multiscale linear filter bank of Gabor functions, (b) a steerable-pyramid linear filter bank (Simoncelli & Freeman, 1995), (c) the VGG-19 model for which the learned parameters (weights) were randomly scrambled within layer, and (d) the CaffeNet model at multiple time points during training. For the Gabor decomposition, the following Gabor filters were used: all compositions of $\sigma = \bar { \{ 1 , 2 , 4 , 8 , 1 6 , 3 2 , 6 4 \} } \mathrm { p x }$ , $\lambda = \{ 1 , 2 \} \cdot \sigma$ , orientation $\underline { { \underline { { \mathbf { \Pi } } } } } = \{ 0 , \pi / 3 , 2 \pi / 3 , \pi , 4 \pi / 3 , 5 \pi / 3 \}$ , and phase $= \{ 0 , \pi / 2 \}$ .
# 8.3 IMAGE PERTURBATION EXPERIMENT
The noiseless images were obtained from Alam et al. (2014). In main text, ”image scale” refers to percent coverage of DNN input. Since size of original images $( 1 4 9 \times 1 4 9 )$ is smaller than DNN input of $( 2 2 4 \times 2 2 4 )$ or $( 2 2 7 \times 2 2 7 )$ ), the images were resized by a factor of 1.5 so that $100 \%$ image scale covers approximately the entire DNN input area.
Human psychophysics and DNN experiments were done for nearly identical images. A slight discrepancy relates to how the image is blended with the background in the special case where the region where noise is added has no image surround at one or two side. In these sides (which depend on the technical procedure with which images were obtained, see Alam et al., 2014), the surround blending here was hard, while the original was smooth.
# 8.4 BACKGROUND CONTEXT EXPERIMENT
# 8.4.1 SEGMENTATION
The images used are based on the Texture Discrimination Task (Karni & Sagi, 1991). In the variant considered here (Pinchuk-Yacobi et al., 2015), subjects were presented with a grid of lines, all of which were horizontal, except two or three that were diagonal. Subjects discriminated whether the arrangement of diagonal lines is horizontal or vertical, and this discrimination was found to be more difficult when the central line is horizontal rather than diagonal (”Hard” vs. ”Easy” in Figure 2a). To limit human performance in this task, two manipulations were applied: (a) the location of each line in the pattern was jittered, and (b) a noise mask was presented briefly after the pattern. Here we only retained (a).
A total of 90 configurations were tested, obtained by combinations of the following alternatives:
• Three scales: line length of 9, 12.3, or $1 9 . 4 \ \mathrm { p x }$ (number of lines co-varied with line length, see Figure 12). • Three levels of location jittering, defined as a multiple of line length: $\{ 1 , 2 , 3 \} \cdot 0 . 0 6 2 5 \cdot l$ px, where $l$ is the length of a line in the pattern. Jittering was applied separately to each line in the pattern. • Ten locations of diagonal lines: center, random, four locations of half-distance from center to corners, four locations of half-distance from center to image borders.
For each configuration, the discriminated arrangement of diagonal lines was either horizontal or vertical, and the central line was either horizontal or diagonal (i.e. hard or easy).
 Figure 12: Pattern scales used in the different configurations of the Segmentation condition. Actual images used were white-on-black rather than black-on-white.
# 8.4.2 CROWDING
The images used are motivated by the crowding effect (Livne & Sagi, 2007; Pelli et al., 2004).
A total of 90 configurations were tested, obtained by combinations of the following alternatives:
• Three scales: font size of 15.1, 20.6, or $3 2 . 4 { \mathrm { p x } }$ (see Figure 13). • Three levels of discriminated-letter location jittering, defined as a multiple of font size: $\{ 1 , 2 , 3 \} \cdot 0 . 0 6 2 5 \cdot l$ px, where $l$ is font size. The jitter of surround letters (M, N, S, and T) was fixed (i.e. the background was static). • Ten locations: center, random, four locations of half-distance from center to corners, four locations of half-distance from center to image borders.
For each configuration, the discriminated letter was either A, B, C, D, E, or F, and the background was either blank (easy) or composed of the letters M, N, S, and T (hard).
 Figure 13: Pattern scales used in the different configurations of the Crowding condition. Actual images used were white-on-black rather than black-on-white.
# 8.4.3 SHAPE
The images used are based on the object superiority effect by Weisstein & Harris (1974), where discriminating a line location is easier when combined with surrounding lines a shape is formed.
A total of 90 configurations were tested, obtained by combinations of the following alternatives:
• Three scales: discriminated-line length of 9, 15.1, or 22.7 px (see Figure 14). • Five levels of whole-pattern location jittering, defined as a multiple of discriminated-line length: $\{ 1 , 2 , 5 , 1 0 , 1 \bar { 5 } \} \cdot 0 . 0 6 2 5 \cdot l$ px, where $l$ is the length of the discriminated line.
• Six ”hard” background line layouts (patterns $b { - } f$ of their Figure 2 and the additional pattern $f$ of their Figure 3 in Weisstein & Harris, 1974). The ”easy” layout was always the same (pattern $a$ ).
For each configuration, the line whose location is discriminated had four possible locations (two locations are shown in Figure 2c), and the surrounding background line layout could compose a shape (easy) or not (hard).

Figure 14: Pattern scales used in the different configurations of the Shape condition. Actual images used were white-on-black rather than black-on-white.
# 8.5 CONTRAST SENSITIVITY EXPERIMENT
Used images depicted sine gratings at different contrast, spatial frequency, sine phase, and sine orientation combinations.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467# NEURAL MAXIMUM COMMON SUBGRAPH DETECTION WITH GUIDED SUBGRAPH EXTRACTION
Anonymous authors Paper under double-blind review
# ABSTRACT
Maximum Common Subgraph (MCS) is defined as the largest subgraph that is commonly present in both graphs of a graph pair. Exact MCS detection is NPhard, and its state-of-the-art exact solver based on heuristic search is slow in practice without any time complexity guarantee. Given the huge importance of this task yet the lack of fast solver, we propose an efficient MCS detection algorithm, NEURALMCS, consisting of a novel neural network model that learns the nodenode correspondence from the ground-truth MCS result, and a subgraph extraction procedure that uses the neural network output as guidance for final MCS prediction. The whole model guarantees polynomial time complexity with respect to the number of the nodes of the larger of the two input graphs. Experiments on four real graph datasets show that the proposed model is $3 1 . 7 8 \times$ faster than the exact solver while achieving near-perfect accuracy in MCS detection.
# 1 INTRODUCTION
Graph data are ubiquitous. Due to its flexible and expressive nature, graphs have been used to store data of various domains. In computational biology, atomic networks can represent molecular compounds. In software analysis, program dependence graphs can describe the data and control dependencies. In social science, social networks can represent community structures. Because of graphs’ unique ability to capture these data, algorithms tackling novel tasks on graphs across different domains have been gaining increased interest in the representation learning community.
Graph matching, in particular, is a recently popular task with new approaches such as Zanfir & Sminchisescu (2018), Bai et al. (2019a), and Li et al. (2019). These methods either produce a score indicating how much and/or how well two graphs match or a graph alignment indicating how and where two graphs match. The latter case is a far more difficult task than the former one. Current methods perform a special case of graph alignment, namely image matching, where the two input graphs are of spatial structures (ex. pixel grids, object orientation, etc.) To account for more general graphs, we extract the Maximum Common Subgraph (MCS) (Bunke & Shearer, 1998), a widely used metric for graph alignment, and perform matching on the extracted subgraphs.
MCS is a very useful metric to match two graphs in real-world applications. For example, in drug discovery, identifying compounds sharing similar substructures which tend to share similarity properties can dramatically reduce the amount of molecules that need to be manually tested (Ehrlich & Rarey, 2011). In addition to molecular science, MCS also has application values in malware detection (Park et al., 2013), pattern recognition (Solnon et al., 2015), computer-aided circuit design (Djoko et al., 1997; Li et al., 2012), etc. Unfortunately, MCS is NP-hard and, to the best of our knowledge, no existing algorithms tackle this problem from a purely machine learning approach.
We are among the first to tackle graph matching defined by MCS. This is more challenging than image matching or graph similarity computation, because MCS requires the extraction of the largest connected subgraph that is commonly present in both input graphs. This implies that the two extracted subgraphs must not only be contained in both graphs but also be isomorphic to each other. To capture the MCS definition, our proposed model, NEURALMCS, fundamentally changes the way that the representations are learned. Instead of computing similarity all in one step, we introduce an iterative procedure to match nodes one at a time. By selecting nodes successively, we ensure the extracted subgraphs are connected. We utilize subgraph embeddings to perform a stopping condition check, dealing with subgraph isomorphism and ending the procedure when the connected subgraphs are the largest. By performing this iterative procedure, we both better ensure the isomorphism of the extracted subgraph as well as capture the recurrent relationship between matching pairs of nodes.
 Figure 1: For a graph pair $( \mathcal { G } _ { 1 } , \mathcal { G } _ { 2 } )$ , previous works (Bai et al., $2 0 1 9 \mathrm { a }$ ; 2018; Li et al., 2019) focus on predicting their graph-graph similarity score. In this work, we aim to find the Maximum Common Subgraph (MCS) (circled in red), which requires fine-grained node-node correspondence prediction. It is more useful both due to the application value as described in Section 1 and because of the interpretable similarity result indicated by the node-node mapping. Node text indicates node labels.
We experimentally verify NEURALMCS on four real graph datasets. and show that NEURALMCS can achieve $4 8 . 1 \times$ runtime gain over state-of-the-art exact MCS computation algorithm MCSPLIT (McCreesh et al., 2017), and is much more accurate than all the baseline approximate approaches to graph matching.
# 2 PROBLEM DEFINITION AND PRELIMINARIES
# 2.1 PROBLEM DEFINITION
We denote a graph as $\mathcal { G } = ( V , E )$ with node set $V$ and edge set $E$ . We define as an induced subgraph as $\boldsymbol { \mathcal { G } } ^ { \prime } = ( \boldsymbol { V } ^ { \prime } , \boldsymbol { E } ^ { \prime } )$ where $V ^ { ' } \subseteq V$ and $E ^ { ' } \subseteq E$ and $E ^ { ' }$ preserves all edges between nodes in $V ^ { ' }$ in the original graph $\mathcal { G }$ . In other words, for two nodes in $V ^ { ' }$ , if there is an edge between them in $\mathcal { G }$ , the induced subgraph must also contain the edge. In the rest of the paper, we use the term “subgraph” to refer to “induced subgraph”.
In this work, our goal is to detect the Maximum Common Subgraph (MCS) for an input graph pair $( \mathcal { G } _ { 1 } , \mathcal { G } _ { 2 } )$ . In general, MCS refers to the largest (induced) subgraph that is common to both graphs. In this paper, we make the following qualifications:
• Labeled graph. The nodes of $\mathcal { G } _ { 1 }$ and $\mathcal { G } _ { 2 }$ are labeled, and nodes of different labels cannot be matched. • Connected subgraph. We require the detected subgraph to be connected, which is a common qualification consistent with McCreesh et al. (2017).
Our goal is to detect the MCS for an input graph pair $\mathcal { G } _ { 1 } , \mathcal { G } _ { 2 }$ . We adopt the state-of-the-art exact solver, MCSPLIT (McCreesh et al., 2017), to provide ground-truth MCS results for a set of training graph pairs. Specifically, MCSPLIT provides not only the nodes that are included in the MCS in both graphs, but also the node-node correspondence in the MCS, as illustrated in Figure 1.
# 2.2 NODE REPRESENTATION LEARNING
Among various node embedding methods, GRAPH MATCHING NETWORKS (GMN) (Li et al., 2019) are recent models designed for graph similarity computation. GMN is based on GRAPH CONVOLUTIONAL NETWORKS (GCN) (Kipf & Welling, 2016), but in addition to message passing within a graph (intra-graph), GMN explicitly handles inter-graph information passing between the two input graphs.
First, GMN performs explicit cross-graph communication on node embeddings denoted as $\mathbf { \Omega } _ { h } ( l )$ where initial node features have $l = 0$ . More specifically, cross-graph communication is achieved through the following attention based mechanism: $\begin{array} { r } { a _ { j \to i } = \frac { \exp ( \cos ( \pmb { h } _ { i } ^ { ( l ) } , \pmb { h } _ { j } ^ { ( l ) } ) } { \sum _ { j ^ { \prime } } \exp ( \cos ( \pmb { h } _ { i } ^ { ( l ) } , \pmb { h } _ { j ^ { \prime } } ^ { ( l ) } ) } } \end{array}$ Next, a softmax function is applied to the cosine similarity between two node embeddings which makes sure similar node pairs across graphs receive greater attention. This weight is then multiplied with the difference between cross-graph node embeddings to allow all node pairs in the two graphs to communicate with each other. Finally each node embedding resulted from inter-graph message passing is concatenated with embedding from intra-graph neighborhood aggregation and placed through a MLP or a GRU core to complete a single layer update of a $h _ { i }$ .
# 3 THE PROPOSED APPROACH: NEURALMCS
Our proposed approach, NEURALMCS, relies on the learning capacity of the embedding model to generate a good matching matrix for each input graph pair, encoding the likelihood of each nodenode pair being included in the MCS and matched to each other. Therefore, the training process aims to learn a matching matrix for each graph pair that is as close to the ground-truth node-node correspondence (as illustrated in Figure 1) as possible.
However, we suppose that a good matching matrix by itself is not enough for an accurate prediction of the MCS, mainly due to the fact that MCS by definition requires the two extracted subgraphs must be isomorphic to each other and both subgraphs must also be connected (see Section 2.1). To satisfy these two requirements, we propose a novel GUIDED SUBGRAPH EXTRACTION (GSE) process that iteratively performs a guided search procedure to enlarge both extracted subgraphs using the matching matrix as guidance. The rest of the section details our proposed approach.
# 3.1 MATCHING MATRIX GENERATION
Our task fundamentally requires the matching between two graphs. Therefore, the ideal node embeddings should receive information from the nodes of both graphs. Thus, we adopt the state-of-theart node embedding model, GRAPH MATCHING NETWORKS (GMN), as described in Section 2.2. Specifically, we stack $L$ GMN layers on the input node representations to allow inter-graph message passing at multiple scales for sufficient interaction of the two graphs. We denote the final node representations as U1 ∈ R|V1|×D(L) and U2 ∈ R|V2|×D(L) .
To match nodes from the input graphs, we compute the likelihood of matching each node in $\mathcal { G } _ { 1 }$ to each node in $\mathcal { G } _ { 2 }$ . This likelihood indicates which node pair is most likely to be in the MCS, and should account for cases where some nodes in $\mathcal { G } _ { 1 }$ do not match any nodes in $\mathcal { G } _ { 2 }$ (and vice-versa). We naturally encode these likelihoods into a matching matrix, $Y \in [ 0 , 1 ] ^ { | \mathcal { G } _ { 1 } | \times | \mathcal { G } _ { 2 } | }$ .
To compute $\mathbf { Y }$ , one can simply calculate the dot product between the node embeddings, $U _ { 1 } \pmb { U } _ { 2 } ^ { \top }$ . However, this resulting matrix is simply the similarity score between each pair of nodes in the two graphs, which is in the range of $( - \operatorname { i n f } , + \operatorname { i n f } )$ and requires further processing to reflect the probability of the node pair matched and being included in the MCS.
As this matrix encode the general similarity between nodes, we denote it as the similarity matrix, $\boldsymbol { X }$ , and further normalize it to obtain $\mathbf { Y }$ . Specifically, we perform the following transformations.
To find the likelihood of each node in one graph matching each node in the other graph, we apply column-wise and row-wise normalization on $\boldsymbol { X }$ .
$$\tilde { p } _ { c o l n } ( i , j ) = \frac { e ^ { X _ { i j } } } { \sum _ { k } e ^ { X _ { i k } } } , ~ \tilde { p } _ { r o w } ( i , j ) = \frac { e ^ { X _ { i j } } } { \sum _ { k } e ^ { X _ { k j } } }$$
To allow for some nodes to go unmatched, we multiply these likelihoods by a value encoding the overall matching score of a node in one graph to nodes in the other graph.
$$p _ { c o l n } ( i , j ) = \sigma ( \frac { \sum _ { j } X _ { i j } } { | V _ { 2 } | } ) \cdot \tilde { p } _ { c o l n } ( i , j ) , ~ p _ { r o w } ( i , j ) = \sigma ( \frac { \sum _ { i } X _ { i j } } { | V _ { 1 } | } ) \cdot \tilde { p } _ { r o w } ( i , j )$$
We consider both row-wise and column-wise normalization by taking the average of both scores, $\begin{array} { r } { \tilde { p } ( i , j ) = \frac { p _ { c o l n } ( i , j ) + p _ { r o w } ( i , j ) } { 2 } } \end{array}$ , and, to ensure we only select nodes with the same labels, we mask out node pairs with different labels to form $\mathbf { Y }$ .
# 3.2 LEARNING OF NEURALMCS
Although there exist multiple points where we can apply our loss function (before, during, or after GSE), we found that applying binary cross entropy loss as early as possible allows for GMN to receive a better learning signal. For this reason, our loss function acts directly on the matching matrix.
 Figure 2: A detailed illustration of NEURALMCS using the example graph pair in Figure 1. For the input graph pair $( \mathcal { G } _ { 1 } , \mathcal { G } _ { 2 } )$ , the NEURALMCS first generates a matching matrix encoding the likelihood of each pair of node being matched ((a) and (b)). The GUIDED SUBGRAPH EXTRACTION (GSE) process uses the matching matrix as follows: NEURALMCS selects the initial pair to be included in the predicted MCS, node 2 in $\mathcal { G } _ { 1 }$ and node 6 in $\mathcal { G } _ { 2 }$ ((b) and (c)). Next, NEURALMCS sets its search frontier as the neighbors of the selected nodes, circled in dashed blue lines. By selecting the pair with the largest matching score which still preserves subgraph isomorphism, node 3 in $\mathcal { G } _ { 1 }$ and node 5 in $\mathcal { G } _ { 2 }$ , the extracted subgraphs in both graphs grow to size 2 ((d) and (e)). The procedure continues until a stopping condition is reached, which is detailed in Section 3.3.
Specifically, we design the following loss function to train the model $\begin{array} { r } { L ( \pmb { Y } ) = - \sum _ { i } \sum _ { j } \frac { I _ { i j } l o g ( Y _ { i j } ) } { | V _ { 1 } | \cdot | V _ { 2 } | } } \end{array}$ where $Y _ { i j }$ denotes our predicted matching matrix and $I _ { i j }$ denote an indicator value of whether the node $i$ matches node $j$ in the ground truth.
Since for a given graph pair, there can be multiple correct MCSs of equal size, we also employ multiple choice learning (Guzman-Rivera et al., 2012; Li et al., 2018). This is done by ensembling various copies of the model and propagating the loss function only through the copy which achieves the lowest loss, as shown by the following: $L = m i n _ { \mathbf { Y } \in \mathcal { Y } } ( L ( \mathbf { Y } ) )$ .
# 3.3 GUIDED SUBGRAPH EXTRACTION (GSE)
Given a matching matrix $\mathbf { Y }$ encoding the matching likelihood for all node pairs between $\mathcal { G } _ { 1 }$ and $\mathcal { G } _ { 2 }$ , we propose the following GUIDED SUBGRAPH EXTRACTION (GSE) process. It starts by finding the most likely pair, and iteratively expands the extracted subgraphs by selecting one more node pair at a time. The procedure stops once the addition of any additional pair would lead to non-isomorphic subgraphs. In summary, the proposed algorithm is shown in Algorithm 1. A detailed illustration using an example pair from Figure 1 is shown in Figure 2.
The GSE algorithm internally maintains a binary assignment matrix $_ { \mathbf { T } }$ which will be the final output indicating the predicted MCS, and a masking matrix $M$ , which is used to mask and select entries of the matching matrix $\mathbf { Y }$ . Both matrices are of the same dimension as $\mathbf { Y }$ . $\mathbf { T }$ is initialized to all zeros, indicating no selected nodes, i.e. extracted subgraphs are zero-size. $M$ is initialized to all ones, since NEURALMCS may select any node pair for its initial subgraph.
To select the most likely node matching, the algorithm decides which pair of nodes should be selected (see Section 3.3.1 for details) by order of their matching scores. This involves checking whether the selection of the pair would result in two isomorphic subgraphs or not. Only if so, the algorithm would select the pair (circled in red in Figure 1) and include it in the predicted MCS by updating $T _ { i ^ { \dag } , j ^ { \dag } }$ to be 1. Once a new node pair is included, GSE updates the mask $M$ to reflect the
# Algorithm 1 GUIDED SUBGRAPH EXTRACTION (GSE)
1: Input: $\left\{ A _ { 1 } , A _ { 2 } \right\}$ , $\mathbf { Y }$ , node embeddings $\{ U _ { 1 } , U _ { 2 } \}$ , . 2: Output: Assignment matrix $_ { \mathbf { T } }$ . 3: Initialize $T \gets 0 * Y$ . \\ initialize to all zeros 4: Initialize $M \gets 1 * Y$ . \\ initialize to all ones 5: Initialize update True 6: while update $=$ True 7: $\mathbf { I } $ sorted indices by highest to lowest value of elements in $\mathbf { M } \odot \mathbf { Y }$ 8: for node pair $( { \bf i } ^ { \dag } , j ^ { \dag } ) { \bf \bar { \Lambda } } = { \bf I }$ 9: update $\because \mathtt { F a l s e }$ 10: Compute subgraph embeddings $w _ { 1 } , w _ { 2 }$ via Equation 4. 11: if $| | \boldsymbol { \bar { w } } _ { 1 } - \boldsymbol { w } _ { 2 } | | _ { 2 } \stackrel { - } { \le } \epsilon \stackrel { \cdot } { \backslash } \backslash$ subgraph isormorphism check 12: Select the found pair $( i ^ { \dagger } , j ^ { \dagger } )$ by updating $T _ { i ^ { \dagger } , j ^ { \dagger } } \gets 1$ . 13: Expand the search frontier by updating the mask $M$ via Equation 6. 14: update $\gets$ True 15: break
search frontier for the next iteration (see Section 3.3.2 for details) and proceeds to the next iteration. Since the MCS by definiton requires the extracted subgraphs to be connected graphs, we define the search frontier as the first-order neighboring nodes of the current selected nodes. This guarantees the final predicted MCS satisfies the connectivity constraint described in Section 1.
# 3.3.1 SUBGRAPH ISOMORPHISM CHECK
To decide whether node pair $( i ^ { \dagger } , j ^ { \dagger } )$ from the search frontier can be selected or not, we check if the inclusion of node $i ^ { \dagger }$ in $\mathcal { G } _ { 1 }$ and $j ^ { \dagger }$ in $\mathcal { G } _ { 2 }$ would result in two isomorphic subgraphs. To do this, we compute the two subgraph-level embeddings, ${ \pmb w } _ { 1 }$ and ${ \pmb w } _ { 2 }$ and check if their Euclidean distance is greater than a hyperparameter threshold $\epsilon$ . A more detailed discussion can be found in Appendix H and I.
Computing the subgraph-level embeddings, however, involves more than a simple aggregation of node embeddings from $U _ { 1 }$ or $U _ { 2 }$ . This is because for subgraph isomorphism check, we are only concerned with nodes included in the subgraph. The nodes outside the selected subgraph should not affect the nodes inside. However, during node embedding generation, both intra- and inter-graph message passing are performed, resulting in $U _ { 1 }$ and $U _ { 2 }$ containing unwanted information.
Inspired by the Weisfeiler-Lehman (WL) algorithm for approximate graph isomorphism test (Shervashidze et al., 2011), as well as the connection between the WL algorithm and the GCNs, we recompute the node embeddings by only aggregating neighboring nodes that are included in the current predicted MCS indicated by $\mathbf { T }$ :
$$\begin{array} { r } { U _ { 1 } ^ { ( k + 1 ) } = A _ { 1 } ( \pmb { v _ { 1 } } \odot \pmb { U } _ { 1 } ^ { ( k ) } ) , } \\ { U _ { 2 } ^ { ( k + 1 ) } = A _ { 2 } ( \pmb { v _ { 2 } } \odot \pmb { U } _ { 2 } ^ { ( k ) } ) , } \end{array}$$
where $\pmb { A }$ denotes the adjacency matrix, ${ \pmb v } _ { 1 } \in \{ 0 , 1 \} ^ { | V _ { 1 } | }$ and $v _ { 2 } \in \{ 0 , 1 \} ^ { | V _ { 2 } | }$ are defined as the row and column summation1 of $\mathbf { T }$ , i.e. $\begin{array} { r } { v _ { 1 i } = \sum _ { j = 1 } ^ { | V _ { 2 } | } T _ { i , j } , v _ { 2 j } = \sum _ { i = 1 } ^ { | V _ { 1 } | } T _ { i , j } } \end{array}$ , followed by setting $v _ { 1 i ^ { \dagger } }$ and $v _ { 2 j ^ { \dagger } }$ to 1, and $_ { v \odot U }$ denotes element-wise multiplication, i.e. $( v \odot U ) _ { i , j } = v _ { i } U _ { i , j }$ . For each graph, this performs message passing between nodes in the extracted subgraph plus the node $i ^ { \dagger }$ (for $\mathcal { G } _ { 1 }$ ) or $j ^ { \dagger }$ (for $\mathcal { G } _ { 2 }$ ). All the edges between these nodes are involved via the adjacency matrices $\pmb { A } _ { 1 }$ and $A _ { 2 }$ , ensuring the subgraph is an induced subgraph required by the MCS definition as mentioned in Section 2.1.
The above updates are performed for $K$ times to yield the final subgraph node embeddings denoted as U (K) ∈ R|V1|×D(K) and $U _ { 2 } ^ { ( K ) } \ \in \ \mathbb { R } ^ { | V _ { 2 } | \times D ^ { \hat { ( } K ) } }$ . We finally compute the two subgraph-level embeddings whose Euclidean distance is computed for apporximate subgraph isomorphism test:
$$\begin{array} { r } { \pmb { w } _ { 1 } = \sum _ { i = 1 } ^ { | V _ { 1 } | } ( \pmb { v } _ { 1 } \odot \pmb { U } _ { 1 i , : } ^ { ( K ) } ) , } \\ { \pmb { w } _ { 2 } = \sum _ { j = 1 } ^ { | V _ { 2 } | } ( \pmb { v } _ { 2 } \odot \pmb { U } _ { 2 j , : } ^ { ( K ) } ) , } \end{array}$$
# 3.3.2 SEARCH FRONTIER EXPANSION
As the search process finds more node pairs, the mask $M$ reflects the search frontier, i.e. the candidate node pairs for the next iteration to select from. Specifically, $M _ { i , j }$ denotes whether the node pair $( i , j )$ should be a candidate pair, and the sorting for node pairs is performed on $M \odot Y$ .
Once node pair $( i ^ { \dagger } , j ^ { \dagger } )$ is selected by passing the check described in Section 3.3.1, GSE updates the search frontier by first obtaining two binary vectors indicating the neighbors of the selected nodes. Since each row of the adjacency matrix indicates the neighbors of the nodes of a particular graph, and we need to include neighbors of all the selected nodes, we first perform the following aggregation of rows of the adjacency matrix:
$$\begin{array} { r } { \pmb { p } _ { 1 } = ( \sum _ { i = 1 } ^ { | V _ { 1 } | } \pmb { v } _ { 1 } \odot \pmb { A } _ { 1 i , : } ) \odot ( 1 - \pmb { v } _ { 1 } ) , } \\ { \pmb { p } _ { 2 } = ( \sum _ { j = 1 } ^ { | V _ { 2 } | } \pmb { v } _ { 2 } \odot \pmb { A } _ { 2 j , : } ) \odot ( 1 - \pmb { v } _ { 2 } ) . } \end{array}$$
The $( 1 - v )$ term is for excluding the nodes that are already selected, which is key for ensuring that the next step does not select nodes that are already selected. This further guarantees that the final $_ { \mathbf { T } }$ matrix is an assignment matrix as required by Equation 3.
To obtain a binary indicator vector for the neighbors of selected nodes, we apply an element-wise indicator function, checking whether each entry of $\pmb { p } _ { 1 }$ and $\mathbf { \mathit { p } } _ { 2 }$ is greater than zero, yielding $\pmb q _ { 1 } ~ \in$ $\{ 0 , 1 \} ^ { | V _ { 1 } | }$ and $\pmb { q } _ { 2 } \in \{ 0 , 1 \} ^ { | V _ { 2 } | }$ . Then we can obtain the updated mask $M$ via
$${ \cal M } = q _ { 1 } \otimes q _ { 2 } ,$$
where $\otimes$ denotes the dyadic product of two vectors. This allows the selection to choose from the pairs formed by the nodes indicated by $\pmb q _ { 1 }$ and $\pmb { q } _ { 2 }$ .
# 3.4 OVERALL TIME COMPLEXITY
Each GMN layer involves the message passing for all node-node pairs, whose time complexity is quadratic with respect to the number of nodes. The matching matrix computation computes the dot product for all node-node pairs. The GSE process selects one node pair each time, and expands the search frontier by reaching to neighbors of selected nodes. Thus, GSE in the worst case reaches out to all nodes of the smaller of the two input graphs, and each GSE step involves a quadratic mask computation. Therefore, NEURALMCS runs in ${ \cal \bar { O } } ( s * | V _ { 1 } | * | V _ { 2 } | * l o g ( | V _ { 1 } | * | V _ { 2 } | ) )$ time, where $s$ is the size of the predicted MCS, which in the worst case is $\operatorname* { m i n } ( | V _ { 1 } | , | V _ { 2 } | )$ .
# 4 EXPERIMENTS
We evaluate NEURALMCS on its accuracy and efficiency against the state-of-the-art exact MCS solver, MCSPLIT (McCreesh et al., 2017), and current machine learning approaches (Zanfir & Sminchisescu, 2018; Wang et al., $2 0 1 9 \mathrm { a }$ ; Velickovic et al., 2018; Li et al., 2019), on four realworld datasets, AIDS, LINUX, IMDB, and REDDIT from a diverse range of domains. Our baselines incldude the state-of-art MCS computation algorithm, MCSPLIT (McCreesh et al., 2017), IMAGEGMN (Zanfir & Sminchisescu, 2018), IMAGE-PCA (Wang et al., 2019a), BASIC-GAT (Velickovic et al., 2018), and BASIC-GMN (Li et al., 2019). Appendix A and B give more details.
# 4.1 EVALUATION METRICS
For accuracy, we evaluate an exact and a soft metric:
$${ \mathrm { E x a c t ~ } } \% = { \frac { \sum _ { i } ^ { N } C ( S _ { i 1 } , S _ { i 2 } ) \cdot \mathbf { 1 } _ { ( \left| S _ { i 1 } \right| = \left| { \mathrm { M C S } } _ { i } \right| ) } } { N } }$$
$$\mathrm { S o f t } ~ \% = \frac { \sum _ { i } ^ { N } C ( S _ { i 1 } , S _ { i 2 } ) \cdot \frac { | S _ { i 1 } | + | S _ { i 2 } | } { 2 | \mathrm { M C S } _ { i } | } } { N }$$
where $N$ is the number of graph pairs in the testing set; $S _ { i 1 }$ and $S _ { i 2 }$ are the subgraphs extracted from the first and second graph, respectively; $C ( \cdot , \cdot )$ is a function that returns 1 if the two input graphs are isomorphic to each other and 0 otherwise; 1 is the indicator function that returns 1 when the condition is true and 0 otherwise; $| \mathrm { M C S } _ { i } |$ is the true MCS size. For efficiency, we evaluate the average running time across graph pairs.
# 4.2 RESULTS
We see that in terms of accuracy, NEURALMCS improves current methods of subgraph extraction substantially, especially on the AIDS and LINUX datasets, where NEURALMCS performs close to the ground truth solver. For IMDB and REDDIT, the performance is also drastically higher than the baselines. Most interestingly, we find that, when the model does not find the exact ground-truth solution, it still extracts high-quality subgraphs with sizes on average above $90 \%$ of the true MCS size, where all graphs are isomorphic (see Appendix E). The poor performance of computer vision baselines IMAGE-GMN and IMAGE-PCA suggests that the assumptions for image matching do not work for MCS based graph matching very well. Appendix F provides a thorough analysis of the performance boost from each component of the proposed model compared with various alternative designs. Compared against the 2 basic models, we see that both the representation learning scheme and the extraction strategy greatly enhance the performance of the model. The exact accuracy results can be seen in Table 1.
Table 1: Exact $\%$ and Soft $\%$ accuracy metrics across four real graph datasets. All methods have been adapted for the MCS detection task. MCSPLIT is the ground-truth MCS solver labeled with \*.
<table><tr><td rowspan="2">Method</td><td colspan="2">AIDS</td><td colspan="2">LINUX</td><td colspan="2">IMDB</td><td colspan="2">REDDIT</td></tr><tr><td>Exact %</td><td>Soft %</td><td>Exact %</td><td>Soft %</td><td>Exact %</td><td>Soft %</td><td>Exact %</td><td>Soft %</td></tr><tr><td>MCSPLIT *</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>IMAGE-GMN</td><td>0.033</td><td>0.033</td><td>19.790</td><td>19.790</td><td>N/A</td><td>N/A</td><td>20.261</td><td>20.261</td></tr><tr><td>IMAGE-PCA</td><td>0.229</td><td>0.229</td><td>22.693</td><td>22.693</td><td>38.582</td><td>38.582</td><td>33.987</td><td>33.987</td></tr><tr><td>BASIC-GAT</td><td>11.013</td><td>22.199</td><td>41.135</td><td>53.070</td><td>47.462</td><td>51.680</td><td>37.908</td><td>50.196</td></tr><tr><td>BASIC-GMN</td><td>12.488</td><td>19.256</td><td>48.082</td><td>52.590</td><td>55.273</td><td>62.738</td><td>43.137</td><td>51.782</td></tr><tr><td>NEURALMCS</td><td>98.525</td><td>99.626</td><td>99.674</td><td>99.955</td><td>97.235</td><td>99.613</td><td>96.078</td><td>99.562</td></tr></table>
In terms of efficiency, NEURALMCS is $3 1 . 7 8 \times$ faster than the ground-truth solver averaged across the four datasets, while being slightly slower than the baselines.
However, as shown in Table 1, the baseline methods fail to consider the connectivity and subgraph isomorphism constraints during maximum common subgraph extraction resulting in worse accuracy. The exact performance results can be seen in Figure 3.
 Figure 3: Running time comparison.
# 4.3 CASE STUDY
The iterative expansion ensures that extracted subgraphs satisfy the connectivity constraint. The representation learning component ensures that we select the correct node at each step. As seen in Figure 4, for the AIDS dataset, the learnable matching matrix helps NEURALMCS select good nodes, and, for the IMDB dataset, the iterative procedure indeed helps our model stop once adding additional nodes would break the isomorphism constraint. More importantly, our model is also able to solve both the subgraph isomorphism and graph matching problems. Additional case studies and analysis can be found in Appendix J.
 Figure 4: Case study: Three MCS examples from each dataset. AIDS has node labels as node text. For clarity, we draw only two node-node correspondences for each example, represented as dashed lines between nodes in the two graphs.
# 5 RELATED WORK
Graph isomorphism is a classic problem that goes back to at least the early work by Sussenguth (1965) and Corneil & Gotlieb (1970). Recently Babai (2016) shows that graph isomorphism can be solved in quasipolynomial time. However, graph isomorphism is only concerned with whether two graphs are exactly the same or not, which may be too rigid in real-world applications. For example, what if two graphs are not isomorphic? In such scenario, a more useful output can be the similarity (or distance) between them, defined by metrics such as Graph Edit Distance (GED) (Bunke, 1983), Maximum Common Subgraph (MCS) (Bunke & Shearer, 1998; Bunke, 1997).
In this work, we focus on the more challenging task of graph matching, specifically the matching of two graphs defined by the MCS metric. The MCS detection problem is NP-hard, and remain computationally challenging. Existing works use constraint programming (Vismara & Valery, 2008; McCreesh et al., 2016), branch-and-bound (McCreesh et al., 2017; Liu et al., 2019), mathematical programming (Bahiense et al., 2012), reduction to maximum clique detection (Levi, 1973; McCreesh et al., 2016), etc. MCS has many definitions tailored to different graph types and application specifics (McCreesh et al., 2017), and is a domain-agnostic metric to compare graphs in a detailed way, so it has occurred widely in applications such as graph database systems (Yan et al., 2005), cloud computing platforms (Cao et al., 2011), etc.
The term “graph matching” is very general and has been adopted by many recent works: (1) Graph similarity computation (Bai et al., 2019a; Li et al., 2019) aims to output a similarity score for an input graph pair, which can be defined by the MCS metric but less challenging due to the score output. (2) Image matching is a classic task in computer vision with traditional approaches based on quadratic assignment problem solving (Zhou & De la Torre, 2012; Yu et al., 2018) and more recent methods using neural networks (IMAGE-GMN (Zanfir & Sminchisescu, 2018) and IMAGEPCA (Wang et al., 2019a)). (3) The two-graph alignment (Heimann et al., 2018; Xu et al., 2019) problem deals with the alignment of two general structured graph objects. However, the alignment is typically not defined by domain-agnostic metrics such as GED or MCS. There is currently no such methods learning from ground-truth graph pairs to the best of our knowledge.
# 6 CONCLUSION
In this paper, we propose a neural network approach to solve the NP-hard problem, Maximum Common Subgraph (MCS) detection, in an approximate and accurate way. For an input graph pair, our model NEURALMCS computes the likelihood of each pair of nodes being included in the MCS and matched, which is used by the proposed GUIDED SUBGRAPH EXTRACTION (GSE) algorithm to iteratively include more and more nodes in the predicted MCS. The whole model runs in polynomial time complexity, and experimental results on four real graph datasets demonstrate that NEURALMCS is $3 1 . 7 8 \times$ faster than the exact solver whole achieving very good accuracy compared to a series of strong approximate graph matching baseline approaches.
# REFERENCES
Laszl ´ o Babai. Graph isomorphism in quasipolynomial time. In ´ STOC, pp. 684–697. ACM, 2016.
Laura Bahiense, Gordana Manic, Breno Piva, and Cid C De Souza. The maximum common edge ´ subgraph problem: A polyhedral investigation. Discrete Applied Mathematics, 160(18):2523– 2541, 2012.
Yunsheng Bai, Hao Ding, Yizhou Sun, and Wei Wang. Convolutional set matching for graph similarity. NeurIPS Workshop on Relational Representation Learning Workshop, 2018.
Yunsheng Bai, Hao Ding, Song Bian, Ting Chen, Yizhou Sun, and Wei Wang. Simgnn: A neural network approach to fast graph similarity computation. WSDM, 2019a.
Yunsheng Bai, Hao Ding, Yang Qiao, Agustin Marinovic, Ken Gu, Ting Chen, Yizhou Sun, and Wei Wang. Unsupervised inductive whole-graph embedding by preserving graph proximity. IJCAI, 2019b.
Albert-Laszl ´ o Barab ´ asi and R ´ eka Albert. Emergence of scaling in random networks. ´ science, 286 (5439):509–512, 1999.
Horst Bunke. What is the distance between graphs. Bulletin of the EATCS, 20:35–39, 1983.
Horst Bunke. On a relation between graph edit distance and maximum common subgraph. Pattern Recognition Letters, 18(8):689–694, 1997.
Horst Bunke and Kim Shearer. A graph distance metric based on the maximal common subgraph. Pattern recognition letters, 19(3-4):255–259, 1998.
Ning Cao, Zhenyu Yang, Cong Wang, Kui Ren, and Wenjing Lou. Privacy-preserving query over encrypted graph-structured data in cloud computing. In 2011 31st International Conference on Distributed Computing Systems, pp. 393–402. IEEE, 2011.
Derek Gordon Corneil and Calvin C Gotlieb. An efficient algorithm for graph isomorphism. Journal of the ACM (JACM), 17(1):51–64, 1970.
Surnjani Djoko, Diane J. Cook, and Lawrence B. Holder. An empirical study of domain knowledge and its benefits to substructure discovery. TKDE, 9(4):575–586, 1997.
Hans-Christian Ehrlich and Matthias Rarey. Maximum common subgraph isomorphism algorithms and their applications in molecular science: a review. Wiley Interdisciplinary Reviews: Computational Molecular Science, 1(1):68–79, 2011.
Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
Abner Guzman-Rivera, Dhruv Batra, and Pushmeet Kohli. Multiple choice learning: Learning to produce multiple structured outputs. In NeurIPS, pp. 1799–1807, 2012.
Mark Heimann, Haoming Shen, Tara Safavi, and Danai Koutra. Regal: Representation learningbased graph alignment. In CIKM, pp. 117–126. ACM, 2018.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015.
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. ICLR, 2016.
Philip A Knight. The sinkhorn–knopp algorithm: convergence and applications. SIAM Journal on Matrix Analysis and Applications, 30(1):261–275, 2008.
Harold W Kuhn. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83–97, 1955.
Der-Tsai Lee and Bruce J Schachter. Two algorithms for constructing a delaunay triangulation. International Journal of Computer & Information Sciences, 9(3):219–242, 1980.
Giorgio Levi. A note on the derivation of maximal common subgraphs of two directed or undirected graphs. Calcolo, 9(4):341, 1973.
Wenchao Li, Zach Wasson, and Sanjit A Seshia. Reverse engineering circuits using behavioral pattern mining. In 2012 IEEE international symposium on hardware-oriented security and trust, pp. 83–88. IEEE, 2012.
Yujia Li, Chenjie Gu, Thomas Dullien, Oriol Vinyals, and Pushmeet Kohli. Graph matching networks for learning the similarity of graph structured objects. ICML, 2019.
Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Combinatorial optimization with graph convolutional networks and guided tree search. In NeurIPS, pp. 539–548, 2018.
Yongjiang Liang and Peixiang Zhao. Similarity search in graph databases: A multi-layered indexing approach. In ICDE, pp. 783–794. IEEE, 2017.
Yan-li Liu, Chu-min Li, Hua Jiang, and Kun He. A learning based branch and bound for maximum common subgraph problems. IJCAI, 2019.
Ciaran McCreesh, Samba Ndojh Ndiaye, Patrick Prosser, and Christine Solnon. Clique and constraint models for maximum common (connected) subgraph problems. In International Conference on Principles and Practice of Constraint Programming, pp. 350–368. Springer, 2016.
Ciaran McCreesh, Patrick Prosser, and James Trimble. A partitioning algorithm for maximum common subgraph problems. 2017.
Younghee Park, Douglas S Reeves, and Mark Stamp. Deriving common malware behavior through graph clustering. Computers & Security, 39:419–430, 2013.
Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-lehman graph kernels. JMLR, 12(Sep):2539–2561, 2011.
Christine Solnon, Guillaume Damiand, Colin De La Higuera, and Jean-Christophe Janodet. On the complexity of submap isomorphism and maximum common submap problems. Pattern Recognition, 48(2):302–316, 2015.
Edward H Sussenguth. A graph-theoretic algorithm for matching chemical structures. Journal of Chemical Documentation, 5(1):36–43, 1965.
Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. ICLR, 2018.
Philippe Vismara and Benoˆıt Valery. Finding maximum common connected subgraphs using clique detection or constraint satisfaction algorithms. In International Conference on Modelling, Computation and Optimization in Information Systems and Management Sciences, pp. 358–368. Springer, 2008.
Runzhong Wang, Junchi Yan, and Xiaokang Yang. Learning combinatorial embedding networks for deep graph matching. ICCV, 2019a.
Xiaoli Wang, Xiaofeng Ding, Anthony KH Tung, Shanshan Ying, and Hai Jin. An efficient graph indexing method. In ICDE, pp. 210–221. IEEE, 2012.
Yue Wang and Justin M Solomon. Deep closest point: Learning representations for point cloud registration. ICCV, 2019.
Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. ACM Transactions on Graphics (TOG), 38(5): 146, 2019b.
Hongteng Xu, Dixin Luo, Hongyuan Zha, and Lawrence Carin. Gromov-wasserstein learning for graph matching and node embedding. ICML, 2019.
Xifeng Yan, Philip S Yu, and Jiawei Han. Substructure similarity search in graph databases. In SIGMOD, pp. 766–777. ACM, 2005.
Pinar Yanardag and SVN Vishwanathan. Deep graph kernels. In SIGKDD, pp. 1365–1374. ACM, 2015.
Tianshu Yu, Junchi Yan, Yilin Wang, Wei Liu, et al. Generalizing graph matching beyond quadratic assignment model. In NeurIPS, pp. 853–863, 2018.
Andrei Zanfir and Cristian Sminchisescu. Deep learning of graph matching. In CVPR, pp. 2684– 2693, 2018.
Zhiping Zeng, Anthony KH Tung, Jianyong Wang, Jianhua Feng, and Lizhu Zhou. Comparing stars: On approximating graph edit distance. PVLDB, 2(1):25–36, 2009.
Xinyi Zhang and Lihui Chen. Capsule graph neural network. ICLR, 2019.
Xiang Zhao, Chuan Xiao, Xuemin Lin, Qing Liu, and Wenjie Zhang. A partition-based approach to structure similarity search. PVLDB, 7(3):169–180, 2013.
Weiguo Zheng, Lei Zou, Xiang Lian, Dong Wang, and Dongyan Zhao. Graph similarity search with edit distance constraint in large graph databases. In CIKM, pp. 1595–1600. ACM, 2013.
Feng Zhou and Fernando De la Torre. Factorized graph matching. In CVPR, pp. 127–134. IEEE, 2012.
# A DATASET DESCRIPTION
We run experiments on 4 diverse different real world datasets coming from the chemical, programming language, and social network domains. For each dataset, we split the pairs into training, validation, and testing sets in the ratio of 6:2:2 such that none of the training, validation, or testing sets share any common graphs. For each dataset, we either one-hot encode node labels, if the dataset has node labels, or provide the same initial encoding, if the dataset does not have node labels. The code and the datasets have been published to this anonymous link: https://github.com/openpublicforpapers/NeuralMCS.
# A.1 AIDS
AIDS is a dataset of antivirus screen chemical compounds, coming from the Developmental Therapeutics Program at $\mathrm { N C I } / \mathrm { N I H } ^ { 2 }$ . The AIDS dataset has been used by various works in graph matching (Zeng et al., 2009; Wang et al., 2012; Zheng et al., 2013; Zhao et al., 2013; Liang & Zhao, 2017; Bai et al., 2019a). These graphs consist of labeled nodes and unlabeled edges, where nodes represent chemical elements (ex. Carbon, Nitrogen, Chlorine, and etc.) and edges represent bonds between atoms. There are a total of 700 graphs, from which we sample 29610 graph pairs. The average graph size is 8.664 with the largest graph having 10 nodes.
# A.2 LINUX
LINUX is a dataset of program dependence graphs (PDG) describing individual functions generated from the Linux kernel (Wang et al., 2012). These graphs consist of unlabeled nodes and unlabeled edges, where nodes represent statements and edges represent control flow between statements. There are a total of 1000 graphs, from which we sample 60114 graph pairs. The average graph size is 7.591 and the largest graphs have 10 nodes.
# A.3 IMDB
IMDB is a dataset of ego-networks of movie actors/actresses from the IMDB website (Yanardag & Vishwanathan, 2015). This dataset has been used by various works in graph classification (Zhang & Chen, 2019; Bai et al., 2019b). These graphs consist of unlabeled nodes and unlabeled edges, where nodes represent actors/actresses and edges represent whether they have had collaborations. There are a total of 1500 graphs, from which we sample 135702 graph pairs. The average graph size is 12.981 and the largest graphs have 89 nodes.
# A.4 REDDIT
REDDIT is a dataset of online dicussion networks from the Reddit online discussion website (Yanardag & Vishwanathan, 2015). These graphs consist of unlabeled nodes and unlabeled edges, where nodes represent users and edges represent whether users have responded to eachother’s comments. There are a total of 7112 graphs, from which we sample 3556 pairs. The average graph size is 11.8 nodes and the largest graph has 16 nodes.
# B BASELINES
We evaluate NEURALMCS against the state-of-the-art solver, MCSPLIT, which uses heuristics and the branch and bound algorithm to achieve efficient computation for MCS. While the fastest among exact solvers, this method still has, in the worst case, exponential time complexity (McCreesh et al., 2017). For this reason, in practice, its running time is much slower than the other approximate baselines. However, we still use MCSPLIT to generate ground-truth MCS results and it only takes a few days on a standard CPU server with multi-threading to handle all the ground-truth result generation.
The representation learning baselines are adapted from recent graph matching techniques, specifically IMAGE-GMN (Zanfir & Sminchisescu, 2018) and IMAGE-PCA (Permutation Loss and Crossgraph Affinity) (Wang et al., 2019a). Both these methods utilize similarity scores and normalization to perform graph matching. As IMAGE-GMN uses CNN layers to form their node embeddings from images (with techniques such as Delaunay triangulation (Lee & Schachter, 1980)), we adapt the model to our task by replacing these layers with 3 GAT layers, consistent with NEURALMCS. IMAGE-PCA uses a node embedding mechanism similar to GMN, not requiring further adaptation. As the loss functions for both these methods were designed for image graphs, we alter their loss functions to binary cross entropy loss (the same as NEURALMCS).
We conduct the extraction process by first removing all nodes where its corresponding summation of similarity scores across rows or columns falls below a tuneable threshold (the values of which can be found in Appendix C) in the matching matrix, then selecting an equal number of nodes in both graphs. The latter is done by maximizing the similarity scores of uniquely selected node pairs through applying the Hungarian Algorithm (Kuhn, 1955) on the remaining nodes of the matching matrix. This is because the extracted subgraphs, after just thresholding, may be of different sizes due to thresholding. The extra procedure ensures that we extract subgraphs of equal sizes and in addition, the Hungarian Algorithm yields one-to-one node-node correspondences for the extracted subgraphs. However, these methods do not necessarily result in isomorphic subgraphs.
We also compare against two basic models, BASIC-GAT (Velickovic et al., 2018) and BASICGMN (Li et al., 2019), which use 3 GAT and GMN layers respectively to encode the initial node features, followed by similarity score computation. These baselines uses a simpler normalization scheme by appling element-wise sigmoid function $( y = 1 / ( 1 + e ^ { - x } ) )$ to the matching matrix, and directly feed the similarity matrix to the same loss function as defined by NEURALMCS. BASICGAT and BASIC-GMN use the same extraction method as the graph matching baselines.
With exception to MCSPLIT, all these baselines run in polynomial time complexity with respect to the number of nodes in the two input graphs.
# C PARAMETER SETTINGS
For our model, we utilize 3 layers of GMN with 64 dimensions each for the initial embedding. We use ${ \mathrm { R e L U } } ( x ) = { \mathrm { m a x } } ( 0 , x )$ as our activation function. We fix the number of outputs for multiple choice learning to 10 on the AIDS, LINUX, and REDDIT datasets, and to 3 on the IMDB dataset. To evaluate the efficacy of multiple choice learning, we also use the same technique and settings for BASIC-GAT and BASIC-GMN. We set $\epsilon$ to $1 0 ^ { - 4 }$ , to account for numerical errors during floating point arithmetic. For the extraction procedure in our baselines, we set the threshold to 0.5 on the AIDS, LINUX, and REDDIT datasets, and to 0.7 on the IMDB dataset. We ran all experiments with Intel i7-6800K CPU and one Nvidia Titan GPU. For training, we set the batch size to 64, the learning rate to 0.001, the number of iterations to 5000, and use the Adam optimizer (Kingma & Ba,
2015). All experiments were implemented with the PyTorch and PyTorch Geometric libraries (Fey & Lenssen, 2019).
For more on dataset setup and training/validation/testing splits, please refer to Appendix A. For more on baseline setups, including their extraction procedure, please refer to Appendix B. For more on the extraction procedure of NEURALMCS, please refer to the main text.
# D DETAILS ON EVALUATION PROCEDURE
As mentioned in Section 4.1, for a graph pair $i$ in the test set, we first check whether the predicted MCS satisfies the MCS constraints or not. In this section we give more details.
Denote the extracted subgraphs from the $i$ -th graph pair as $S _ { i 1 }$ and $S _ { i 2 }$ , respectively. The MCS constraint satisfaction check includes the following steps: First, we check if $S _ { i 1 }$ and $S _ { i 2 }$ are both connected (i.e. no isolated components); Second, we check if $S _ { i 1 }$ and $S _ { i 2 }$ are isomorphic to each other. Since exact isomorphism checking may take a long time in practice, we set a timeout for exact isomorphism checking, and when timeout happens, we switch to an approximate checker3. The timeout as well as the whole procedure is applied across all the methods to ensure fair comparison.
When we generate $S _ { i 1 }$ and $S _ { i 2 }$ for NEURALMCS in the first place, we would take the induced subgraph, satisfying the inductivity constraint mentioned in Section 2.1. Specifically, we use the output assignment matrix $\mathbf { T }$ and check if a node has a 1 in its corresponding row (for $\mathcal { G } _ { 1 }$ ) or column (for $\mathcal { G } _ { 2 }$ ) in $_ { \mathbf { T } }$ to decide whether it is selected in the predicted MCS.
Notice that by checking the size of the extracted subgraphs against the ground-truth MCS size (Equation 7 and 8), we allow equal-sized MCS results to be evaluated correctly, since for many graph pairs there are more than one correct MCS result.
Here we give more insights behind the two metrics. The intuition behind the hard metric is that we only check whether the the extracted subgraphs are strictly equal to the size of the true MCS or not. However, this is too strict and does not reveal too much information about the model performance when the extracted subgraphs are not the same size as the true MCS. An easy measure would be to directly report on the predicted MCS size, but this does not take into account non-isomorphic subgraphs. The soft metric accounts for both these issues by checking the fraction of the predicted MCS size over the true MCS size only for isomorphic subgraphs. Notice that if the predicted MCS is even larger than the true MCS, the $C ( \cdot , \cdot )$ function will return 0 because it is not possible for the subgrpahs to be both larger than the true MCS (generated by the exact solver MCSPLIT) and isomorphic.
# E RESULT ANALYSIS
In addition to Exact $\%$ and Soft $\%$ metrics, we may also evaluate our model on the percentage of extracted subgraphs which are isomorphic $( \mathrm { I s o } \%$ ).
Following the same notation used to define Exact $\%$ and Soft $\%$ , we define Iso $\%$ as follows:
$$\mathrm { I s o ~ \% } = { \frac { \sum _ { i } ^ { N } C ( S _ { i 1 } , S _ { i 2 } ) } { N } }$$
As seen in Table 2, NEURALMCS explicitly encodes the isomorphism constraint into the stopping condition. This is one reason why NEURALMCS is able to achieve high accuracy, especially in Soft $\%$ in Table 1. Notice, our method does not guarantee exclusion of false-positives (predicting isomorphic when not isomorphic), as it is possible for 2 differently structured graphs, with different node embeddings, to have the same subgraph embedding once all the node embeddings are aggregated. Because these situations are relatively rare (both graphs would need to have the same subgraph embedding to floating point precision), NEURALMCS is extract isomorphic subgraphs $100 \%$ of the time on the provided datasets. Our model does guarantee exclusion of false-negatives, as, if two graphs are isomorphic, our embedding propagation methodology must produce the same subgraph embeddings.
Table 2: Iso $\%$ accuracy metric across four real graph datasets. All methods have been adapted for the MCS detection task. Dataset descriptions and details can be found in Appendix A.
<table><tr><td>Method</td><td>AIDS</td><td>LINUX</td><td>IMDB</td><td>REDDIT</td></tr><tr><td>McSPLIT *</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>IMAGE-GMN</td><td>0.033</td><td>19.790</td><td>N/A</td><td>20.261</td></tr><tr><td>IMAGE-PCA</td><td>0.229</td><td>22.693</td><td>38.582</td><td>33.987</td></tr><tr><td>BASIC-GAT</td><td>80.039</td><td>82.269</td><td>99.365</td><td>73.856</td></tr><tr><td>BASIC-GMN</td><td>91.183</td><td>97.230</td><td>96.924</td><td>95.425</td></tr><tr><td>NEURALMCS</td><td>100.000</td><td>100.000</td><td>100.000</td><td>100.000</td></tr></table>
# F ABLATION STUDY
We first form a matching matrix then extract a subgraph guided by this matrix. To form the matching matrix, we utilize representation learning to make node embeddings; compute $\boldsymbol { X }$ using similarity scores from node embeddings (Section 3.1); compute $\mathbf { Y }$ through normalization of $\boldsymbol { X }$ (Section 3.1). To perform extraction, we utilize the GUIDED SUBGRAPH EXTRACTION method proposed (Section 3.3).
We perform more in-depth ablation studies to show the importance of each component whose results are shown in Table 3.
Table 3: Abaltion study results on AIDS. The numbers are the “Exact $\%$ ” defined in Section 4.1.
<table><tr><td rowspan="2">Matching Matrix Computation</td><td colspan="3">Subgraph Extraction Strategy</td></tr><tr><td>GSE</td><td>Threshold</td><td>Threshold +LSAP</td></tr><tr><td>GMN+ Our Normalization</td><td>98.525 (NEURALMCS)</td><td>25.795</td><td>17.076</td></tr><tr><td>GAT+ Our Normalization</td><td>98.525</td><td>26.057</td><td>17.339</td></tr><tr><td>DGCNN+ Our Normalization</td><td>96.657</td><td>22.091</td><td>13.045</td></tr><tr><td>GMN + Sigmoid</td><td>97.083</td><td>10.521</td><td>12.488 (BASIC-GMN)</td></tr><tr><td>GMN + Sinkhorn Softmax</td><td>60.439</td><td>12.488</td><td>0.197</td></tr></table>
# F.1 ON THE IMPORTANCE OF GMN
GAT $^ +$ Our Normalization and DGCNN $^ +$ Our Normalization use GAT (Velickovic et al., 2018) and DGCNN (Wang et al., 2019b) used in Wang & Solomon (2019) respectively to perform node embeddings. Interestingly, when fed into our proposed GSE step, their exactly solved percentages are quite close to GMN, which is close to perfectly detecting the MCSs for all the testing pairs. Even with simpler thresholding based subgraph extraction strategies (see Section F.3 below for details), their performances are still similar to (or even better than) GMN. This seems to suggest that the choice of node embedding methods does not appear to influence the performance much when our proposed GSE strategy is used.
It should be noted that earlier we used a simpler GSE strategy which always selected the node pair with the largest matching score in $\mathbf { Y }$ in during search frontier expansion. This model did not check all the possible node pairs by sorting the node matching scores and iterate through these pairs for consideration of being selected in the MCS prediction. When tested on this simpler GSE strategy, GMN indeed performed approximately $4 . 0 \%$ better than GAT and DGCNN.
In summary, the choice of node embedding representation methods does not influence the performance too much, and very good accuracy can be obtained when the proposed normalization and GSE methods are both used.
# F.2 ON THE IMPORTANCE OF NORMALIZATION
$\mathrm { G M N } +$ Sigmoid (BASIC-GMN) uses sigmoid normalization on each individual element of the $\boldsymbol { X }$ matrix, instead of our normalization scheme (Section 3.1; Equations 1 and 2) to obtain $\mathbf { Y }$ . As sigmoid treats each node-node pair in $\mathbf { Y }$ as independent (an incorrect assumption), we see that its performance worse than our proposed normalization scheme, especially when the threshold or threshold $+ \ \mathrm { L S A P }$ strategies are used. However, similar to our findings in Section F.1, when our proposed GSE strategy is used, $\mathrm { G M N } + \mathrm { S }$ igmoid performs only slightly worse than NEURALMCS, which further confirming the usefulness of the proposed normalization scheme and the GSE method.
$\mathrm { G M N } +$ Sinkhorn Softmax uses successive row- and column-wise softmax normalization (softmax to ensure that the matching matrix $\mathbf { Y }$ is in the range (0,1)) on the $\boldsymbol { X }$ matrix (similar to the Sinkhorn algorithm (Knight, 2008) used in IMAGE-PCA for image matching4) instead of our normalization scheme. As softmax does not explicitly allow nodes to go unmatched (Section 3.1), as dictated by the MCS definition, we see that our normalization procedure performs much better.
As mention in Section 4.2, the assumptions made for image matching do not naturally transfer to and work well for the MCS detection task. In fact, with the simple element-wise sigmoid normalization on $\boldsymbol { X }$ , the performance is much better than the Sinkhorn normalization technique. The iterative rowand column-wise normalization on $\boldsymbol { X }$ is not a good choice for the task of MCS where nodes can remain unmatched with low scores in the final $\mathbf { Y }$ .
# F.3 ON THE IMPORTANCE OF GSE
For each Matching Matrix Computation method, we run 3 different subgraph extraction strategies: GSE, thresholding, and thresholding $+ \mathrm { L S A P }$ (Linear Sum Assignment Problem which we use the Hungarian algorithm (Kuhn, 1955) to solve, described in Appendix B).
For thresholding, for each of the two graphs, we select the nodes whose probabilities of being included in the MCS are greater than a tunable threshold, yielding two subgraphs. We calculate such probabilities by taking the summation of rows and columns of the matching matrix $\mathbf { Y }$ . More details can be found in Appendix B.
For thresholding $+ \mathrm { L S A P } ,$ , we ensure that the detected subgraphs are of equal size and have a one-toone node-node mapping (to validate their isomorphism) by running the Hungarian algorithm on the remaining rows and columns of $\mathbf { Y }$ after thresholding. We cannot run LSAP on the original $\mathbf { Y }$ since LSAP would select all nodes in the smaller of the two graphs.
Neither of these simpler subgraph extraction methods enforces the subgraph isomorphism constraint, which explains their worse performance compared with GSE.
We find that our major novelties (GSE and normalization technique) are the most important components in producing good performance.
# G SCALABILITY STUDY
is trained on graph pairs with ground-truth MCS results, which can be either obtained by MCSPLIT or the following way which provides cheap supervision without using any exact MCS solver. The high level idea of generating ground-truth MCS training pairs without exact MCS solver is to create such pairs with a smart design instead of computing MCS for any given pair of graphs. One possible way to create such pair is to extract an induced subgraph from a given graph, and the ground-truth MCS of the two graphs is naturally the extracted subgraph. More concretely, our experimental setup is as follows: We generate training graph pairs by first using the BarabsiAlbert model (Barabasi & ´ Albert, 1999) to generate 1000 graphs of size 32. For each generated graph, We randomly extract one connected 16-node subgraph from it. Each generated graph and extracted subgraph form one pair, giving a total of 1000 training graph pairs (our training set). Notice, this generation procedure allows us to know the MCSs during generation.
We follow a similar procedure for testing set, where we use the Barabsi-Albert model to generate 100 graphs of size 16, 32, 64, and 128 (denoted as “Test Dataset Size” in the table below). For each generated graph, we extract one connected 8-, 16-, 32-, and 64- node subgraph respectively. This gives us 5 test sets, each with 100 graph pairs.
We use the following 5 metrics for thorough evaluation:
1. Solved $\%$ : It measures the percentage of pairs that the model can successfully finish within 100 seconds. 2. Soft $\%$ : It measures the fraction of the predicted MCS size over the true MCS size for the isomorphic extracted subgraphs (Appendix D). 3. Iso $\%$ : Among the pairs that can be solved within the time budget, it measures the percentage of pairs whose extracted subgraphs are isomorphic. This is an important metric because subgraph isomorphism is a key constraint required by the definition of MCS. 4. Dev in $\#$ nodes: among the pairs that can be solved within the time budget, it measures the average deviation of the number of nodes in the predicted MCS versus the number of nodes in the true MCS. The range of this metric is $[ 0 , N ]$ where $\mathbf { N }$ is the number of nodes of the largest graph in a dataset. This metric gives a more intuitive understanding of the performance of a model compared to “Soft $\%$ ” since it reports the number of nodes directly. 5. (Average) Runtime (msec): It measures the average running time per testing pairs that the model solves within the time budget. In other words, if a model fails at solving a pair within the time budget, the runtime will NOT be taken into account by this metric for fair comparison
We set the time budget to 100 seconds and 500 seconds for MCSPLIT respectively, and the results are shown in Table 4.
Table 4: Scalability study results on AIDS.
<table><tr><td>Test Dataset size</td><td>Metrics</td><td>MCSPLIT (100s)</td><td>MCSPLIT (500s)</td><td>McSPLIT</td></tr><tr><td rowspan="5">16</td><td>Solved %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Soft %</td><td>100.000</td><td>100.000</td><td>99.625</td></tr><tr><td>Iso %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Dev in # nodes</td><td>0</td><td>0</td><td>0.030</td></tr><tr><td>Runtime (msec)</td><td>295.576</td><td>236.502</td><td>550.688</td></tr><tr><td rowspan="5">32</td><td>Solved %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Soft %</td><td>100.000</td><td>100.000</td><td>99.563</td></tr><tr><td>Iso %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Dev in # nodes</td><td>0</td><td>0</td><td>0.070</td></tr><tr><td>Runtime (msec)</td><td>333.793</td><td>340.310</td><td>787.901</td></tr><tr><td rowspan="5">64</td><td>Solved %</td><td>61.000</td><td>62.000</td><td>100.000</td></tr><tr><td>Soft %</td><td>61.000</td><td>62.000</td><td>98.843</td></tr><tr><td>Iso %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Dev in # nodes</td><td>0</td><td>0</td><td>0.370</td></tr><tr><td>Runtime (msec)</td><td>4509.056</td><td>10351.813</td><td>940.581</td></tr><tr><td rowspan="5">128</td><td>Solved %</td><td>26.000</td><td>28.000</td><td>100.000</td></tr><tr><td>Soft %</td><td>26.000</td><td>28.000</td><td>75.484</td></tr><tr><td>Iso %</td><td>100.000</td><td>100.000</td><td>100.000</td></tr><tr><td>Dev in # nodes</td><td>0</td><td>0</td><td>15.690</td></tr><tr><td>Runtime (msec)</td><td>1220.117</td><td>18809.848</td><td>1194.089</td></tr></table>
NEURALMCS achieves performance close to the exact ground truth solver in terms of accuracy, and can scale to much larger graphs which the exact solver fails, most of the time, at solving within the time budget.
For accuracy, we see that the size of MCS extracted for the model is often over $98 \%$ the true MCS size. Interestingly, for graphs of size 64, we find that the extracted subgraphs differ between our model and the true MCS only in less than one node (0.37 nodes) on average. This indicates that our proposed method (NEURALMCS) can detect MCS that the current state of the art (MCSPLIT) cannot, due to our careful design and the incorporation of learning algorithms.
For running time, our model is comparable to or slower than the ground truth detector for simpler cases (¡ 1 second) but much faster for larger graphs. This could be due to our model incurring overhead from Python implementation, while MCSPLIT is implemented in $\mathrm { C } { + } { + }$ . However, when the dataset size equals 128, MCSPLIT fails for most pairs, as the MCS problem is NP-hard, while NEURALMCS can solve all the pairs due to guaranteed time complexity (Section 3.4). Notice, there is no theoretical time complexity guarantee for MCSPLIT (exponential time complexity in the worst case (McCreesh et al., 2017)), resulting in significant average running time increase from 1220.1 msec to 18809.8 msec when only 2 additional pairs are solved by increasing the time budget from 100 seconds to 500 seconds. In fact, we observed that the actual running time of the branch-andbound algorithm MCSPLIT strongly depends on the actual graph structures varying from graph to graph.
In summary, when graphs are larger and larger, MCSPLIT quickly becomes almost unusable in practice due to an inability to yield results most of the time, while NEURALMCS still extracts highaccuracy MCSs consistently and runs much faster than MCSPLIT with guaranteed theoretical time complexity. In practice, we observe that our model can run successfully on a 12-GB GPU until 4000-node graphs when the GPU runs out of memory, in which case MCSPLIT almost surely cannot be used either.
# H DISCUSSION ON SUBGRAPH ISOMORPHISM CHECKING OF GUIDED SUBGRAPH EXTRACTION
In the proposed GUIDED SUBGRAPH EXTRACTION (GSE) strategy (Section 3.3.1), we check if the inclusion of a new node pair would result in two isomorphic subgraphs by checking if $| | \mathbf { w } _ { 1 } - \pmb { w } _ { 2 } | |$ is smaller than or equal to a threshold, which is a criteria that allows us to punish mismatched nodes more softly. While an iterative check would achieve efficiency benefits by avoiding computing the subgraph embeddings, it assumes at every step we have performed a non-ambiguous matching. For example, suppose we have 2 graphs, where in the current iteration of GSE, we have 2 fully connected 3-node subgraphs currently extracted with node-node mappings. We label the node ids of these 2 graphs as 1-2-3 and a-b-c respectively and the mappings as 1-a, 2-b, 3-c. If we select a new node 4 from $\mathcal { G } _ { 1 }$ and a new node d from $\mathcal { G } _ { 2 }$ and 4 is connected to 2 and d is connected to a, an iterative procedure would not be able to tell that the addition of node 4 and d to the MCS is valid (since 2-b is matched but NOT 2-a). Fundamentally, the structure for 1,2,3 and a,b,c are similar, so it is uncertain (and expected) that the computed node matchings would be 2-a, 1-b or 2-b, 1-a.
In contrast, our proposed checking strategy can account for the above-mentioned uncertainty by doing aggregation of node embeddings to obtain subgraph-level embeddings $w _ { 1 }$ and $w _ { 2 }$ , since this does not involve explicitly finding the node-node mappings. Instead, it checks the isomorphism in a more principled way borrowing insights from Weisfeiler-Lehman (WL) graph isomorphism test (Shervashidze et al., 2011). In WL, each node in the two graphs is represented as an aggregation of local node features, and each graph is represented as an aggregation of node labels. The algorithm stops and decides two graphs are not isomorphic when the two graph-level node label sets are different. In our model, the graph-level node label set is equivalent to ${ \pmb w } _ { 1 }$ and ${ \pmb w } _ { 2 }$ , and our GSE decides that the subgraphs are not isomorphic when the two graph-level representations are different enough.
In conclusion, our proposed checking strategy addresses the ambiguous node mapping issue which the iterative isomorphism check could not solve, and is theoretically connected to the WL algorithm for graph isomorphism test.
# I DISCUSSION ON LEARNINING CAPACITY OF GUIDED SUBGRAPH EXTRACTION
In our current model, we form a matching matrix for both training and inference, and perform our loss function on the matching matrix during training (Section 3.2), and utilize GSE (Section 3.3) guided by the matching matrix during inference to extract subgraphs. We use GMN for node embeddings (Section 2.2 and Section 3.1) and feed the matching matrix into GSE, which is fixed during the iterative GSE process. However, one potential issue is that once a node pair is selected, the extracted subgraph grows by one node causing the candidate pairs to change in the next iteration.
Ideally, node embeddings should be updated to reflect such change after each iteration. By introducing learnable components to iteratively update the node embeddings to reflect such change, we can train the GSE component using guidance from the ground-truth node mappings in the MCS, making the training stage and inference stage consistent and match each other.
To accomplish this, we propagate the node embeddings at each iteration of GSE with learnable weights to recompute the matching matrix $\mathbf { Y }$ such that the next iteration’s node embeddings will be conditionally updated based on the current extracted subgraph. To achieve it, we extend GMN to update the node embeddings for the extracted subgraph at each GSE iteration. GMN updates the node embeddings of two graphs jointly by performing intra- and inter-graph message passing. Thus, one can directly apply GMN to the extracted subgraph at each GSE iteration, and calculate the loss function at the end of GSE process (replacing the current BCE loss on the matching matrix $\mathbf { Y }$ ), achieving conditional node embeddings in the GSE step of the model.
In implementation, we make a further modification to GMN by not propagating to matched nodes in the two extracted subgraphs. This is because we want the node embeddings for the currently extracted isomorphic subgraphs to stay as consistent as possible and not be influenced by any unpicked nodes in the larger graph or any nodes from the opposing graph.
We run both modified versions (with and without further modification) of NEURALMCS on AIDS, and the performance increase is only marginal $( < 1 \%$ increase). Therefore, by forgoing this step during training and only using GSE only during testing, we can gain a free speed up in training time.
# J MORE CASE STUDY
All case study plots can be seen in Figure 5. We see that our model is able to differentiate difficult input pairs, where adding any extra nodes would break the MCS constraints. In the LINUX, IMDB, and REDDIT dataset, we see examples where the graph structures are vastly different, yet NEURALMCS is still able to correctly differentiate MCS nodes. In the AIDS dataset, we see the model is able to successfully extract subgraphs which maintain node labels. In the IMDB dataset, we see the model can handle denser and larger size graphs.
 Figure 5: Case study.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320# A MODEL CORTICAL NETWORK FOR SPATIOTEMPORAL SEQUENCE LEARNING AND PREDICTION
Anonymous authors Paper under double-blind review
# ABSTRACT
In this paper we developed a hierarchical network model, called Hierarchical Prediction Network (HPNet) to understand how spatiotemporal memories might be learned and encoded in a representational hierarchy for predicting future video frames. The model is inspired by the feedforward, feedback and lateral recurrent circuits in the mammalian hierarchical visual system. It assumes that spatiotemporal memories are encoded in the recurrent connections within each level and between different levels of the hierarchy. The model contains a feed-forward path that computes and encodes spatiotemporal features of successive complexity and a feedback path that projects interpretation from a higher level to the level below. Within each level, the feed-forward path and the feedback path intersect in a recurrent gated circuit that integrates their signals as well as the circuit’s internal memory states to generate a prediction of the incoming signals. The network learns by comparing the incoming signals with its prediction, updating its internal model of the world by minimizing the prediction errors at each level of the hierarchy in the style of predictive self-supervised learning. The network processes data in blocks of video frames rather than a frame-to-frame basis. This allows it to learn relationships among movement patterns, yielding state-of-the-art performance in long range video sequence predictions in benchmark datasets. We observed that hierarchical interaction in the network introduces sensitivity to memories of global movement patterns even in the population representation of the units in the earliest level. Finally, we provided neurophysiological evidence, showing that neurons in the early visual cortex of awake monkeys exhibit very similar sensitivity and behaviors. These findings suggest that predictive self-supervised learning might be an important principle for representational learning in the visual cortex.
# 1 INTRODUCTION
While the hippocampus is known to play a critical role in encoding episodic memories, the storage of these memories might ultimately rest in the sensory areas of the neocortex (McClelland & McNaughton, 1999). Indeed, a number of neurophysiological studies suggest that neurons throughout the hierarchical visual cortex, including those in the early visual areas such as V1 and V2, might be encoding memories of object images (Huang et al., 2018) and of visual sequences in cell assemblies (Yao et al., 2007; Han et al., 2008; Xu et al., 2012; Cooke & Bear, 2014; 2015). As specific priors, these memories, together with the generic statistical priors encoded in receptive fields and connectivity of neurons, serve as internal models of the world for predicting incoming visual experiences. In fact, learning to predict incoming visual signals has also been proposed as an objective that drives representation learning in a recurrent neural network in a self-supervised learning paradigm, where the discrepancy between the model’s prediction and the incoming signals can be used to train the network using backpropagation, without the need of labeled data (Elman, 1990; Mathieu et al., 2015; Villegas et al., 2017; Srivastava et al., 2015; O’Reilly et al., 2014; Lee, 2015).
In computer vision, a number of hierarchical recurrent neural network models, notably PredNet (Lotter et al., 2016) and PredRNN $^ { + + }$ (Wang et al., 2018), have been developed for video prediction with state-of-the-art performance. PredNet, in particular, was inspired by the neuroscience principle of predictive coding (Mumford, 1991; Rao & Ballard, 1999; Lee, 2015; Dijkstra et al., 2017; Friston, 2018). It learns a LSTM (long short-term memory) model at each level to predict the prediction errors made in an earlier level of the hierarchical visual system. Because the error representations are sparse, the computation of PredNet is very efficient. However, the model builds a hierarchical representation to model and predict its own errors, rather than learning a hierarchy of features of successive complexities and scales to model the world. The lack of a compositional feature hierarchy hampers its ability in long range video predictions.
Here, we proposed an alternative hierarchical network architecture. The proposed model, HPNet (Hierarchical Prediction Network), contains a fast feedforward path, instantiated currently by a fast deep convolutional neural network (DCNN) that learns a representational hierarchy of features of successive complexity, and a feedback path that brings a higher order interpretation to influence the computation a level below. The two paths intersect at each level through a gated recurrent circuit to generate a hypothetical interpretation of the current state of the world and make a prediction to explain the bottom-up input. The gated recurrent circuit, currently implemented in the form of LSTM, performs this prediction by integrating top-down, bottom-up, and horizontal information. The discrepancy between this prediction and the bottom-up input at each level is called prediction error, which is fed back to influence the interpretation of the gated recurrent circuits at the same level as well as the level above.
To facilitate the learning of relationships between movement patterns, HPNet processes data in the unit of a spatiotemporal block that is composed of a sequence of video frames, rather than frame by frame, as in PredNet and $\mathrm { P r e d R N N + + }$ . We used a 3D convolutional LSTM at each level of the hierarchy to process these spatiotemporal blocks of signals (Choy et al., 2016), which is a key factor underlying HPNet’s better performance in long range video prediction.
In the paper, we will first demonstrate HPNet’s effectiveness in predictive learning and its competency in long range video prediction. Then we will provide neurophysiological evidence showing that neurons in the early visual cortex of the primate visual system exhibit the same sensitivity to memories of global movement patterns as units in the lowest modules of HPNet. Our results suggest that predictive self-supervised learning might indeed be an important strategy for representation learning in the visual cortex, and that HPNet is a viable computational model for understanding the computation in the visual cortical circuits.
# 2 RELATED WORKS
Our objective is to develop a hierarchical cortical model for predictive learning of spatiotemporal memories that is competitive both for video prediction, and for understanding the learning principles and the computational mechanisms of the hierarchical visual system. In this regard, our model is similar conceptually to Ullman’s counter-stream model (Ullman, 1995), Mumford’s analysis by synthesis framework (Mumford, 1992), and Hawkin’s hierarchical spatiotemporal memory model (HTM) (Hawkins & George, 2006) for hierarchical cortical processing. At a conceptual level, it can also be considered as a deep learning implementation of hierarchical Bayesian inference model of the visual cortex (Lee & Mumford, 2003; Dayan et al., 1995; Kersten & Yuille, 2003).
HPNet integrates ideas of predictive coding (Mumford, 1992; Rao & Ballard, 1999; Lotter et al., 2016) and associative coding (McClelland & Rumelhart, 1985; Grossberg, 1987). It differs from the predictive coding models (Rao & Ballard, 1999; Lotter et al., 2016) in that it learns a hierarchy of feature representations in the feedforward path to model features in the world as in normal deep convolutional neural networks (DCNN). PredNet, on the other hand, builds a hierarchy to model successive prediction errors of its own prediction of the world. PredNet is efficient because its convolution is operated on sparse prediction error codes, but we believe lacking a hierarchical feature representation limits its ability to model relationships among more global and abstract movement concepts for longer range video prediction. We believe having a fast bottom-up hierarchy of spatiotemporal features of successive scale and abstraction will allow the system to see further into the future and make better prediction.
A key difference between the genre of predictive learning models (HPNet, PredNet) and the earlier predictive coding models implemented by Kalman filters (Rao & Ballard, 1999) or associative coding models implemented by interactive activation (McClelland & Rumelhart, 1985; Grossberg, 1987) is that the synthesis of expectation is not done simply by the feedback path, via weight matrix multiplication, but by local gated recurrent circuits at each level. This key feature makes this genre of predictive learning models more powerful and competent in solving real computer vision problems.
The idea of predictive learning, using incoming video frames as self-supervising teaching labels to train recurrent networks, can be traced back to Elman (1990). Recently, there has been active exploration of self-supervised learning in computer vision (Palm, 2012; O’Reilly et al., 2014; Goroshin et al., 2015; Srivastava et al., 2015; Patraucean et al., 2015; Vondrick et al., 2016), particularly in the area of video prediction research (Mathieu et al., 2015; Kalchbrenner et al., 2017; Tulyakov et al., 2017; Xu et al., 2018; Oh et al., 2015; Villegas et al., 2017; Lee et al., 2018; Wichers et al., 2018). The large variety of models can be roughly grouped into three categories: autoencoders, DCNN, and hierarchy of LSTMs. Some models also involve feedforward and feedback paths, where the feedback paths have been implemented by deconvolution, autoencoder networks, LSTM or adversary networks (Finn et al., 2016; Lotter et al., 2016; Wang et al., 2017; 2018). Some other models, such as variational autoencoders, allowed multiple hypotheses to be sampled (Babaeizadeh et al., 2017; Denton & Fergus, 2018).
PredRNN $^ { + + }$ (Wang et al., 2018) is the state-of-the-art hierarchical model for video prediction. It consists of a stack of LSTM, with the LSTM at one level providing feedforward input directly to the LSTM at the next level, and ultimately predicting the next video frame at its top level. Thus, its hierarchical representation is more similar to an autoencoder, with the intermediate layers modeling the most abstract and global spatiotemporal memories of movement patterns and the subsequent layers representing the unfolding of the feedback path into a feedforward network with its top-layer’s output providing the prediction of the next frame. PredR $\mathrm { N N } { + } { + }$ does not claim neural plausibility, but it offers state-of-the-art performance for benchmark performance evaluation, with documented comparisons to other approaches.
Recent single-unit recording experiments in the inferotemporal cortex (IT) of monkeys have shown that neurons responded significantly less to predictable sequences than to novel sequences (Meyer & Olson, 2011; Meyer et al., 2014; Ramachandran et al., 2017), suggesting that neural activities might signal prediction errors. The novel neurophysiolgical experiment we presented here demonstrated similar prediction suppression effects in the early visual cortex of monkeys for well-learned videos, suggesting neuronal sensitivity to memories of global movement patterns and scene context in the earliest visual areas. This is consistent with other recent studies that showed neurons in mouse V1 might be able to encode some forms of spatiotemporal memories in their recurrent circuits (Han et al., 2008; Xu et al., 2012; Cooke & Bear, 2015).
# 3 HIERARCHICAL PREDICTION NETWORK
# 3.1 CORTICAL MODULE
HPNet is composed of a stack of Cortical Modules (CM). Each CM can be considered as a visual area along the ventral stream of the primate visual system, such as V1, V2, V4 and IT. We used four Cortical Modules in our experiment. The network contains a feedforward path that is realized in a deep convolutional neural network (DCNN), a stack of Long Short Term Memory (LSTM) modules that link the feedforward path and the feedback path together.
Figure 1 (a) shows two CMs stacked on top of each other. The feedforward path performs convolution (indicated by $\star$ ) on the input spatiotemporal block $I _ { l }$ with a kernel to produce $R _ { l }$ , where $l$ indicates CM level. $R _ { l }$ is then down-sampled to provide the input $I _ { l + 1 }$ for $\mathrm { C M } _ { l + 1 }$ for another round of convolution in the feedforward path. $I _ { l + 1 }$ also goes into $\mathrm { L S T M } _ { l + 1 }$ (Lhe STM in $\mathrm { C M t } _ { l + 1 }$ ). In each $\mathrm { C M } _ { l }$ level, the bottom-up input $I _ { l }$ is compared with the prediction $P _ { l }$ generated from the interpretation output $H _ { l }$ of $\mathrm { L S T M } _ { l }$ . The prediction error signal is transformed by a convolution into $E _ { l }$ , which is fed back to both $\mathrm { L S T M } _ { l }$ and $\mathrm { L S T M } _ { l + 1 }$ to influence their generation of new hypotheses $H _ { l }$ and $H _ { l + 1 }$ . To make the timing relationship between the different interacting variables more explicit, we now use $k$ to indicate time step or, equivalently, the video input frame. $\mathrm { L S T M } _ { l }$ at step $k$ integrates the bottom-up feature input $\mathrm { \bar { \cal R } } _ { l - 1 } ^ { k }$ , the top-down feedback of the higher CM’s LSTM’s output $H _ { l + 1 } ^ { k }$ , and the prediction errors $E _ { l - 1 } ^ { k }$ and $E _ { l } ^ { k - d }$ to generate new hypothesis output $H _ { l } ^ { k }$ , which is then transformed into a new prediction $P _ { l } ^ { k }$ , where $d$ is is the number of frames in each spatiotemporal block (details in Algorithm 1).
 Figure 1: (a) Two Cortical Modules stacked on top of each other. The input $I _ { 1 }$ would be the spatiotemporal block of video frames. The $\star$ notation means a convolution along that path. $2 \uparrow$ indicates up-sampling or expansion operation. $2 \downarrow$ means down-sample or reduction in resolution. $\odot$ indicates comparator or subtraction operation; (b) The DCNN analysis path is actually implemented in a sparsified convolution scheme to speed up bottom-up processing; (c) Detailed structure of the LSTM used. $C _ { t }$ is the internal state, and $H _ { t }$ is the output. X is external input, which includes multiple sources in our model. (d) Frame-by-frame method; (e) Block-by-frame method; and (f) Block-by-block method, where left and right part indicates output and input with the middle indicating 2D or 3D convolution LSTM.
# 3.2 SPARSE CONVOLUTION
The feedforward DCNN path in Figure 1 (a) runs much faster if the input to each convolution layer is made sparse, as shown in Pan et al. (2018). In video processing, a scheme has been proposed by Liu et al. (2017); Dave et al. (2017); Pan et al. (2018) to sparsify the input of a convolution layer by performing convolution on the difference $\Delta I _ { l } ^ { k } = I _ { l } ^ { k } - I _ { l } ^ { k - 1 }$ between two consecutive frames, where $k$ indicates the $\mathbf { k }$ -th frame. The resulting $\Delta R _ { l } ^ { k }$ is added back to the representation of the last time frame $R _ { l } ^ { k - 1 }$ to recover the representation at the current frame $R _ { l } ^ { k }$ . This allows the network to maintain a full higher order representation $R$ at all times in the next layer while enjoying the benefit of fast computation on sparse input. In their scheme (Pan et al., 2018), the first frame $I ^ { k = 0 }$ was convolved with a set of dense convolution kernels and then the subsequent frames were convolved with a set of sparse convolution kernels. For parsimony and neural plausibility, we used the same set of sparse kernels for processing both the first full frame and the subsequent temporal-difference frames, at the expense of incurring some inaccuracy in our prediction of the first few frames.
# 3.3 SPATIOTEMPORAL BLOCKS AND 3D CONVOLUTION
The input data of our network model is a sequence of video frames or a spatiotemporal block. For our implementation, each block contains 5 video frames. If we consider that each frame corresponds roughly to $2 5 ~ \mathrm { m s }$ , this would translate into $1 2 5 ~ \mathrm { m s }$ , in the range of the length of temporal kernel of a cortical neuron. Our convolution kernel is in three dimension, processing the video by spatiotemporal blocks. The block could slide in time with a temporal stride of one frame or a stride as large as the length of the block $d$ . The LSTM is a 3D convolutional LSTM (Choy et al., 2016) because of 3D convolution and spatiotemporal blocks. Convolution LSTM (Shi et al., 2015), in which Hadamard product in LSTM is replaced by a convolution, has greatly improved the performance of LSTM in many applications. Earlier video prediction models (e.g. PredNet, PredRNN) processed video sequences frame by frame, as shown in Figure 1 (d). We experimented with different data units and approaches. In the Frame-to-Frame (F-F) approach, an input frame is used to generate one predicted future frame (Figure 1 (d)). In the Block-to-Frame (B-F) approach (Figure 1 (e)), a block of input frames is used to generate one predicted future frame. This approach is time consuming, but provides more accurate near-range predictions. For longer-range predictions, we found using a spatiotemporal block to predict a spatiotemporal block, i.e. the Block-to-Block (B-B) approach ( Figure 1(f)), to be the most effective, because the LSTM learns the relationship between movement segments in the sequences. The details of our algorithm of the 3D convolutional LSTM is specified in Appendix A.
# 3.4 TRAINING AND LOSS FUNCTION
The entire network is trained by minimizing a loss function which is the weighted sum of all the prediction errors, with the following algorithm,
$$\begin{array} { r l } { I _ { l } ^ { k } = \left\{ \begin{array} { l l } { M a x P o o l ( R e L U ( R _ { l - 1 } ^ { k } ) ) } & { l > 1 } \\ { x _ { t } } & { l = 1 } \end{array} \right. P _ { l } ^ { k } = \left\{ \begin{array} { l l } { R e L U ( c o n v ( H _ { l } ^ { k } ) ) } & { l > 1 } \\ { S A T L ( R e L U ( c o n v ( H _ { l } ^ { k } ) ) ) } & { l = 1 } \end{array} \right. } \\ { \Delta I _ { l } ^ { k } = I _ { l } ^ { k } - I _ { l } ^ { k - d } , } & { \Delta E _ { l } ^ { k } = I _ { l } ^ { k } - P _ { l } ^ { k } } \end{array}$$
where $x _ { t }$ is the input sequence, $H _ { l } ^ { k }$ is the output of LSTM, $P _ { l } ^ { k }$ is the prediction, SATLU is a saturating non-linearity set at the maximum pixel value: $\mathrm { S A T L U } ( x ; p _ { m a x } ) { : = \operatorname* { m i n } ( p _ { m a x } , x ) }$ , spconv is sparse convolution, $\lambda _ { k }$ and $\lambda _ { l }$ are weighting factors by time and CM level, respectively, and $n _ { l }$ is the number of units in the lth CM level, and $d$ is the number of frames in each spatiotemporal block. The full algorithm is shown in Algorithm 1.
# 4 EXPERIMENTAL RESULTS
In this section, we first evaluate the performance of our model in video prediction using two benchmark datasets: (1) synthetic sequences of the Moving-MNIST database and (2) the $\mathrm { K T \check { H } ^ { 1 } }$ real world human movement database. We then investigate the representations in the model to understand how recurrent network structures have impacted on the feedforward representation. We finally compare the temporal activities of neurons in the network model with that of neurons in the visual cortex of monkeys, in video sequence learning, to evaluate the plausibility of HPNet.
Since for video prediction, PredNet is the most neurally plausible model and $\mathrm { P r e d R N N + + }$ provides state-of-the-art computer vision performance, we will compare HPNet’s performance with these two network models. Because these two models work on frame-to-frame basis, we implemented three versions of our network for comparison: (1) Frame-to-Frame (F-F), where we set our data spatiotemporal block size to one frame and used 2D convLSTM instead of 3D convLSTM to predict the next frame based on the current frame; (2) Block-to-Frame (B-F), where we used a sliding block window to predict the next frame based on the current block of frames; (3) Block-to-Block (B-B), where the next spatiotemporal block was predicted from the current spatiotemporal block (Figure 1 (d)).
We trained all five networks using 40-frame sequences extracted from the two databases in the same way as described in (Lotter et al., 2016; Wang et al., 2018). We then compared their performance in predicting the next 20 frames when only the first 20 frames were given. The test sequences were drawn from the same dataset but not in the training set. The common practice in PreNet and $\mathrm { P r e d R N N + + }$ for predicting future frames when input is no longer available is to make the prediction of the last time step the next input and use that to generate prediction of the next time step. All models tested have four modules (layers). All three versions of our model and PredNet used the same number of feature channels in each layer, optimized by grid search, i.e. (16,32,64,128) for the Moving-MNIST dataset, and (24,48,96,192) for the KTH dataset. For PredRNN $^ { + + }$ , we used
# Algorithm 1 The algorithm of our model
Input: $I _ { 1 } ^ { k } \gets x _ { t }$ 1: for $t = 1$ to $T$ do 2: for $l = L$ to 1 do . Top-down procedure 3: if $l = L$ then 4: $H _ { l } ^ { k } = 3 D c o n v L S T M ( H _ { l } ^ { k - d } , E _ { l } ^ { k - d } , M a x P o o l ( R e L U ( R _ { l - 1 } ^ { k } , E _ { l - 1 } ^ { k } ) ) )$ 5: else 6: $H _ { l } ^ { k } = 3 D c o n v L S T M ( H _ { l } ^ { k - d } , E _ { l } ^ { k - d } , M a x P o o l ( R e L U ( R _ { l - 1 } ^ { k } , E _ { l - 1 } ^ { k } ) ) , u p s a m p l e ( H _ { l + 1 } ^ { k } ) )$ 7: end if 8: end for 9: for $l = 1$ to $L$ do . Bottom-up procedure 10: if $l = 1$ then 11: $I _ { l } ^ { k } = x _ { t } , \ P _ { l } ^ { k } = S A T L U ( R e L U ( c o n v ( H _ { l } ^ { k } ) ) )$ 12: else 13: $I _ { l } ^ { k } = M a x P o o l ( R e L U ( R _ { l - 1 } ^ { k } ) ) , P _ { l } ^ { k } = R e L U ( c o n v ( H _ { l } ^ { k } )$ 14: end if 15: $\overline { { \Delta I _ { l } ^ { k } } } = I _ { l } ^ { k } - I _ { l } ^ { k - d } , \Delta R _ { l } ^ { k } = s p c o n v ( \Delta I _ { l } ^ { k } ) , R _ { l } ^ { k } = R _ { l } ^ { k - d } + \Delta R _ { l } ^ { k }$ 16: ∆ E kl = I kl − P kl , $E _ { l } ^ { k } = s p c o n v ( \Delta E _ { l } ^ { k } )$ 17: end for 18: end for
the same architecture and feature channel numbers provided by Wang et al. (2018). All kernel sizes are either $3 \times 3$ (for F-F) or $3 \times 3 \times 3$ (for B-F and B-B) for all five models. The input image frame’s spatial resolution is $6 4 \times 6 4$ .
The models were trained and tested on GeForce GTX TITAN X GPUs. We evaluated the prediction performance based on two quantitative metrics: Mean-Squared Error (MSE) and the standard Structural Similarity Index Measure (SSIM) (Wang et al., 2004) of the last 20 frames between the predicted frames and the actual frames. The values of SSIM range from -1 to 1, with a larger value indicating greater similarity between the predicted frames and the actual future frames.
# 4.1 SYNTHETIC SEQUENCE PREDICTION ON THE MOVING-MNIST DATASET
We randomly chose subsets of digits in the Moving MNIST2 dataset in which the video sequences contain two handwritten digits bouncing inside a frame of $6 4 \times 6 4$ pixels. We extracted 40-frame sequences at random starting frame position in the video in the same way as in Srivastava et al. (2015) (followed by PredNet and PredRNN $^ { + + }$ ). This extraction process is repeated 15000 times, resulting in a training set of 10000 sequences, a validation set of 2000 sequences, and a testing set of 3000 sequences.
Figure 2 and Table 1 compare the results of different models on the Moving-MNIST dataset. There are 40 frames in total and we show the results every two frames. The yellow vertical line in the middle represents the border between the first 20 and the last 20 predicted frames by various models. We can see B-F achieves better performance than B-B in short term prediction task when actual input frames are provided, but B-B outperforms B-F in the longer range prediction, reflecting learning of the relationships at the movement levels by the 3D convLSTM. B-F doing better than F-F confirmed that the spatiotemporal block data structure provides additional information for modeling movement tendency. Finally, we found that even F-F achieved better prediction results than PredNet, suggesting that a feature hierarchy might be more useful than a hierarchy of predicted errors. Finally, our B-B network outperformed the state-of-the-art PredRNN $^ { + + }$ .
# 4.2 REAL-WORLD SEQUENCE PREDICTION ON THE KTH DATASET
Schuldt et al. (2004) introduced the KTH video database which contains 2391 sequences of six ¨ human actions: walking, jogging, running, boxing, hand waving, and hand clapping, performed by 25 subjects in four different scenarios. We divided video clips across all 6 action categories into a training set of 108717 sequences (persons $\# 1 - 1 6 )$ ) and a test set of 4086 sequences (persons $\# 1 7$ -
 Figure 2: Video prediction results on Moving-MNIST dataset, where the first row to last row are ground truth (GT), results from three different version of HPNet (block-to-block (B-B), block-toframe (B-F), frame-to-frame (F-F)), PredNet, and $\mathrm { P r e d R N N + + }$ , respectively. ${ \bf k } { = } 1$ to $\mathbf { k } { = } 1 9$ are predicted frames of the models when the input frames were available. $\mathrm { k } { = } 2 1$ to $\mathrm { k } = 3 9$ are the ”deadreckoning” predicted frames of the model when there are no input.
Table 1: Comparison Results of different methods on Moving-MNIST datatset for long time prediction experiment.
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>SSIM</td><td rowspan=1 colspan=1>MSE</td></tr><tr><td rowspan=1 colspan=1>Ours(B-B)</td><td rowspan=1 colspan=1>0.915</td><td rowspan=1 colspan=1>65.2</td></tr><tr><td rowspan=1 colspan=1>Ours(B-F)</td><td rowspan=1 colspan=1>0.793</td><td rowspan=1 colspan=1>73.2</td></tr><tr><td rowspan=1 colspan=1>CM+ConvLSTM (F-F)</td><td rowspan=1 colspan=1>0.692</td><td rowspan=1 colspan=1>89.5</td></tr><tr><td rowspan=1 colspan=1>PredNet (Lotter et al., 2016)</td><td rowspan=1 colspan=1>0.658</td><td rowspan=1 colspan=1>101.2</td></tr><tr><td rowspan=1 colspan=1>PredRNN++ (Wang et al., 2018)</td><td rowspan=1 colspan=1>0.872</td><td rowspan=1 colspan=1>69.4</td></tr></table>
Table 2: Comparison Results of different methods on the KTH datatset for long time prediction experiment.
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>SSIM</td><td rowspan=1 colspan=1>MSE</td></tr><tr><td rowspan=1 colspan=1>Ours(B-B)</td><td rowspan=1 colspan=1>0.882</td><td rowspan=1 colspan=1>80.3</td></tr><tr><td rowspan=1 colspan=1>Ours(B-F)</td><td rowspan=1 colspan=1>0.784</td><td rowspan=1 colspan=1>93.1</td></tr><tr><td rowspan=1 colspan=1>CM+ConvLSTM (F-F)</td><td rowspan=1 colspan=1>0.701</td><td rowspan=1 colspan=1>103.4</td></tr><tr><td rowspan=1 colspan=1>PredNet (Lotter et al., 2016)</td><td rowspan=1 colspan=1>0.656</td><td rowspan=1 colspan=1>108.9</td></tr><tr><td rowspan=1 colspan=1>PredRNN++ (Wang et al., 2018)</td><td rowspan=1 colspan=1>0.865</td><td rowspan=1 colspan=1>86.7</td></tr></table>
25) as was done in Wang et al. (2018), except we extracted 40-frame sequences. We center-cropped each frame to a $1 2 0 \times 1 2 0$ square and then re-sized it to input frame size of $6 4 \times 6 4$ .
 Figure 3: Video prediction results on the KTH dataset, where the first row to last row are ground truth (GT), results from block-to-block (B-B), block-to-frame (B-F), frame-to-frame (F-F), PredNet, and PredRNN $^ { + + }$ , respectively, same format as Figure 2.
Figure 3 and Table 2 compared the results of the different models on the KTH dataset, essentially reproducing all the observations we made based on the Moving-MINST dataset (Figure 2). BB outperformed all tested models in the long range video prediction task. Figure 4 (a) and (b) compared the video prediction performance of the different models in terms of the “dead-reckoning frames” to be predicted when only the first twenty frames were provided for the two datasets. The results show that, in both cases, B-B is far more effective than B-F in long range video prediction. Figure 4 (c) showed that the ratio of SSIM and training time peaks at a 4-module network. The SSIM of a 5-module network was about the same as that of a 4-module network but took longer time to converge. The B-F, with a sliding window of a single frame stride, took much longer to train yet still under-performed. Figure 4 (d) showed SSIM performance and training time of the different models. It shows that the B-B (sparse) version of HPNet took only $10 \%$ longer to train than PredRNN $^ { + + }$ even though it has more loops into the networks and has to process spatiotemporal blocks. Both PredR $\mathrm { N N } { + } { + }$ and HPNet require twice amount of the training time relative to PredNet, illustrating the computational efficiency of using sparse codes. Sparsifying our DCNN feedforward path reduced our B-B network’s training time by $13 \%$ (comparing B-B (sparse) versus B-B (non-sparse) in Figure 4 (d)).
 Figure 4: (a) Comparison of the prediction results of the five models for the Moving-MINST dataset on the last 20 frames in structural similarity measures (SSIM). (b) Comparison of the prediction results on the KTH datset. (c) Comparison of the performance (and training time) of the B-B and the B-F networks as a function of the number of modules in the network. (d) Training time versus SSIM performance of the different models. Note, the training time $\mathbf { \tau } ( \mathbf { x } )$ axis not in a linear scale.
To understand the importance of the hierarchical representation and recurrent feedback in the model, we trained the B-B network with different numbers of modules and then used t-SNE (van der Maaten & Hinton, 2008) to visualize the representation $R$ in the different modules of the various networks in response to the last of the 20 future dead-reckoning frames of 600 testing sequences belonging to the six movements in the KTH dataset. The results are shown in Figure 5. We observed that having more higher modules introduced cluster of global movement patterns in the representation units even in the earliest module (Figure 5 (a) versus Figure 5 (e)), which resulted in significant decoding accuracy improvement in the classification of the six classes of movement patterns, from chance $( 1 6 \% )$ to $26 \%$ , based on the unit activities in the first module alone. The representations of the top module of the 4-module network provide a decoding accuracy of $63 \%$ , suggesting that the HPNet has learned semantically meaningful hierarchical spatiotemporal feature representations (see Appendix B for details) and can learn movement-to-movement relationships for making better long range video predictions (see also Kheradpisheh et al. (2018)). Decoding results indicate that higher order semantic representations of the global movement patterns are significantly weaker or absent in the hierarchical representations of PredRNN or PredNet respectively (see Appendix B for details).
# 4.3 VISUAL SEQUENCE LEARNING EFFECTS IN THE VISUAL CORTEX
Hierarchical feedback in HPNet endows the representations in the earliest Cortical Modules with sensitivity to global movement and image patterns, despite these units’ very localized receptive fields, particularly R in the feedforward path (Figure 5). Could the neurons in the early visual areas of the mammalian hierarchical visual systems behave in a similar way, becoming sensitive to the memory of global movement patterns of familiar movies?
We found this to be the case in a series of neurophysiological experiments that we have performed to study the effect of unsupervised learning of video sequences on the early visual cortical representations. Two monkeys, implanted with Gray-Matter semi-chronic multielectrode arrays (SC32 and SC96) over the V1 operculum with access to neurons in V1 and V2, participated in the experiment. Each experiment lasted for at least seven daily recording sessions. In each recording session, the monkey was required to fixate on a red dot on the screen for a water reward while a set of 40 video clips of natural scenes with global movement patterns was presented. One clip was presented per trial. Each clip lasted for $8 0 0 ~ \mathrm { { m s } }$ . A total of 40 clips were presented once each in a random interleaved fashion in a block of trials, and each block was repeated 20-25 times each day3. Among the
40 movie clips tested every day, twenty of these were the same each day, designated as “Predicted set”. Twenty of them were different each day, designated as “Unpredicted set”. Each set consisted of 20 movies.
 Figure 5: (a)-(d) are the top CM’s R representation of networks with different number of modules, from one to four; (e)-(h) are the representation of each modules in a four-modules network, from the first module to the fourth, left to right. Better clustering leads to better decoding results of the different movement classes. Full details are in Appendix B.
The rationale for the experimental design is as follows. Given that we were recording from $3 0 +$ neurons in each session, even though the neurons have different stimulus preferences in their local receptive fields, each neuron would experience about 400 movie frames for the Predicted movie set, as well as for each of the Unpredicted movie sets. When we averaged the temporal responses of all the neurons to each of the 20-movie sets, they should be roughly the same. In the first two days of the experiment, the clips in the Predicted set were still unpredicted, hence there should have been no difference between the population averaged responses to the Predicted set and the Unpredicted set. This was indeed the case as shown in Figure 6b (top row) which compared the averaged temporal responses of the neurons to the Predicted set and to the Unpredicted set for the first two days of training in one experiment.
Interestingly, we found that after only three days of unsupervised training, with 20-25 exposures of each familiar movie per day, the neurons started to respond significantly less to predicted movies than to novel movies in the later part of their responses, starting around $1 0 0 \mathrm { m s }$ post-stimulus onset, as shown in Figure 6(b) (bottom row). The evolution of daily mean of all neurons’ familiarity suppression index over days is shown as the magenta curve. As the neurons became more and more familiar with the Predicted set, the prediction suppression effect gradually increased and saturated at around the sixth and seventh days. We repeated the experiments six times in two monkeys and obtained fairly consistent results. Note that the movie clips were shown in a $8 ^ { o }$ aperture during the experiment. Given that the V1 and V2 neurons being studied have very local and small receptive fields $0 . 5 ^ { o }$ to $2 ^ { o }$ ), it is rather improbable that the neurons would have remembered or adapted to the local movement patterns of the Predicted set within their receptive fields, as they would be experiencing millions of such local spatiotemporal patterns in their daily experience. Indeed, when the video clips were shown to the neurons through a smaller $3 ^ { o }$ diameter aperture, the prediction suppression effects were much attenuated, suggesting that the neurons had indeed became sensitive to the global context of movement patterns!
To check whether neurons in our network behave in the same way, we performed a similar experiment on our network, pretrained with the KTH dataset. We randomly extracted 20 sequences from the BAIR dataset (Ebert et al., 2017), resized the sequence length to 40 frames and each frame size to $6 4 \times 6 4$ . We separated the 20 video sequences into two sets – the Predicted set and the Unpredicted set. We averaged the responses to the two movie sets respectively of each type of neurons in the network $E$ (prediction error units), $P$ (prediction units), and $R$ (representation units)) in each CM within the center $8 \times 8$ hypercolumns. Before training, the responses of each type of neurons are indeed the same for both movie sets (not shown, but similar to Figure 6(b) data). Then, we trained the network with the Predicted set for 2000 epochs. After training, all three types of units in each
CM exhibited the prediction suppression effect as shown in Figure 6 (c)-(h) (full details in Appendix C).
 Figure 6: (a) The development of the prediction suppression effect across days in one experiment. Each dot is the prediction suppression index of a neuron. Color indicates whether the effect was significant or not (red - significant, blue - insignificant, green - significant in the opposite way) based on t-test with $p < 0 . 0 5$ as statistical significance threshold. (b) Averaged temporal responses of the V1 and V2 neurons (combined) of one monkey to Predicted set and the Unpredicted sets in the first two days (top row), showing no difference. The averaged responses (combining data from day 5 to day 12) to the Predicted set was significantly weaker than the responses to the Unpredicted sets, indicating prediction suppression. (c)-(e) Module 1’s normalized averaged population responses of the three types of units to the Predicted set and the Unpredicted set. (f)-(h) Module 4’s normalized averaged population responses of the three types of units.
We observed the prediction suppression effect in all three types of neurons in all the modules in the hierarchy, with the higher modules showing a stronger effect. It is not surprising that the prediction error neurons $E$ would decrease their responses as the network learns to predict the familiar movies better. It is rather interesting to find the representation neurons $R$ and the prediction neurons $P$ also exhibit prediction suppression, even though these neurons represent features rather than prediction errors. The precise reasons remain to be determined, but the fact that all neuron types in the model exhibited the prediction suppression effect might explain why the prediction suppression effects were commonly observed in most of the randomly sampled neurons in the visual cortex (see Figure 6a). These findings suggest that (1) predictive self-supervised learning might indeed be an important principle and mechanism by which the visual cortex learns its representations, and (2) the neurophysiological observations on prediction suppression in IT (see Appendix D) and now in the early visual cortex might be explained by this class of hierarchical cortical models.
# 5 CONCLUSION
In this paper, we developed a hierarchical prediction network model (HPNet), with a fast DCNN feedforward path, a feedback path and local recurrent LSTM circuits for modeling the counterstream / analysis-by-synthesis architecture of the mammalian hierarchical visual systems. HPNet utilizes predictive self-supervised learning as in PredNet and PredRNN $^ { + + }$ , but integrates additional neural constraints or theoretical neuroscience ideas on spatiotemporal processing, counter-stream architecture, feature hierarchy, prediction evaluation and sparse convolution into a new model that delivers the state-of-the-art performance in long range video prediction. Most importantly, we found that the hierarchical interaction in HPNet introduces sensitivity to global movement patterns in the representational units of the earliest module in the network and that real cortical neurons in the early visual cortex of awake monkeys exhibit very similar sensitivity to memories of global movement patterns, despite their very local receptive fields. These findings support predictive self-supervised learning as an important principle for representation learning in the visual cortex and suggest that HPNet might be a viable computational model for understanding the cortical circuits in the hierarchical visual system at the functional level. Further evaluations are needed to determine definitively whether PredNet or HPNet is a better fit to the biological reality.
# REFERENCES
Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. CoRR, abs/1710.11252, 2017.
Christopher Bongsoo Choy, Danfei Xu, JunYoung Gwak, Kevin Chen, and Silvio Savarese. 3d-r2n2: A unified approach for single and multi-view 3d object reconstruction. In ECCV, 2016.
Sam F. Cooke and Mark F. Bear. How the mechanisms of long-term synaptic potentiation and depression serve experience-dependent plasticity in primary visual cortex. Philosophical transactions of the Royal Society of London. Series B, Biological sciences, 369 1633:20130284, 2014.
Sam F. Cooke and Mark F. Bear. Visual recognition memory: a view from v1. Current opinion in neurobiology, 35:57–65, 2015.
Achal Dave, Olga Russakovsky, and Deva Ramanan. Predictive-corrective networks for action detection. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2067– 2076, 2017.
Peter Dayan, Geoffrey E. Hinton, Radford M. Neal, and Richard S. Zemel. The helmholtz machine. Neural Computation, 7:889–904, 1995.
Emily L. Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, 2018.
Nadine Dijkstra, Peter Zeidman, Sasha Ondobaka, Marcel A J van Gerven, and Karl J. Friston. Distinct top-down and bottom-up brain connectivity during visual perception and imagery. In Scientific Reports, 2017.
Frederik Ebert, Chelsea Finn, Alex Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. In Conference on Robot Learning (CoRL), 2017.
Jeffrey L. Elman. Finding structure in time. Cognitive Science, 14:179–211, 1990.
Chelsea Finn, Ian J. Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NIPS, 2016.
Karl J. Friston. Does predictive coding have a future? Nature Neuroscience, 21:1019–1021, 2018.
Ross Goroshin, Michael Mathieu, and Yann LeCun. Learning to linearize under uncertainty. In ¨ NIPS, 2015.
Stephen Grossberg. Competitive learning: From interactive activation to adaptive resonance. Cognitive Science, 11:23–63, 1987.
Feng Han, Natalia Caporale, and Yang Dan. Reverberation of recent visual experience in spontaneous cortical waves. Neuron, 60:321–327, 2008.
Jeff Hawkins and Dileep George. Hierarchical temporal memory concepts , theory , and terminology. 2006.
Ge Huang, Suchitra Ramachandran, Tai Sing Lee, and Carl R. Olson. Neural correlate of visual familiarity in macaque area v2. The Journal of neuroscience : the official journal of the Society for Neuroscience, 2018.
Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex ¨ Graves, and Koray Kavukcuoglu. Video pixel networks. In ICML, 2017.
Daniel J. Kersten and Alan L. Yuille. Bayesian models of object perception. Current opinion in neurobiology, 13 2:150–8, 2003.
Saeed Reza Kheradpisheh, Mohammad Ganjtabesh, Simon J. Thorpe, and Timothee Masquelier. ´ Stdp-based spiking deep convolutional neural networks for object recognition. Neural networks : the official journal of the International Neural Network Society, 99:56–67, 2018.
Alex X. Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. CoRR, abs/1804.01523, 2018.
Tai Sing Lee. The visual system’s internal models of the world. Proceedings of the IEEE, 103: 1359–1378, 2015.
Tai Sing Lee and David Mumford. Hierarchical bayesian inference in the visual cortex. Journal of the Optical Society of America. A, Optics, image science, and vision, 20 7:1434–48, 2003.
Xingyu Liu, Jeff Pool, Song Han, and William J. Dally. Efficient sparse-winograd convolutional neural networks. CoRR, abs/1802.06367, 2017.
William Lotter, Gabriel Kreiman, and David D. Cox. Deep predictive coding networks for video prediction and unsupervised learning. CoRR, abs/1605.08104, 2016.
William Lotter, Gabriel Kreiman, and David Cox. A neural network trained to predict future video frames mimics critical properties of biological neuronal responses and perception. CoRR, abs/1805.10734, 2018.
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond ¨ mean square error. CoRR, abs/1511.05440, 2015.
James L. McClelland and Bruce L. McNaughton. Complementary learning systems 1 why there are complementary learning systems in the hippocampus and neocortex $:$ Insights from the successes and failures of connectionist models of learning and memory. 1999.
James L. McClelland and David E. Rumelhart. Distributed memory and the representation of general and specific information. Journal of experimental psychology. General, 114 2:159–97, 1985.
Travis Meyer and Carl R. Olson. Statistical learning of visual transitions in monkey inferotemporal cortex. Proceedings of the National Academy of Sciences of the United States of America, 108 48:19401–6, 2011.
Travis Meyer, Christopher Walker, Raymond Y. Cho, and Carl R. Olson. Image familiarization sharpens response dynamics of neurons in inferotemporal cortex. Nature Neuroscience, 17:1388– 1394, 2014.
David Mumford. On the computational architecture of the neocortex. Biological Cybernetics, 65: 135–145, 1991.
David Mumford. On the computational architecture of the neocortex. ii. the role of cortico-cortical loops. Biological cybernetics, 66 3:241–51, 1992.
Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L. Lewis, and Satinder P. Singh. Actionconditional video prediction using deep networks in atari games. In NIPS, 2015.
Randall C. O’Reilly, Dean Wyatte, and John Rohrlich. Learning through time in the thalamocortical loops. 2014.
Rasmus Berg Palm. Prediction as a candidate for learning deep hierarchical models of data. 2012.
Bowen Pan, Wuwei Lin, Xiaolin Fang, Chaoqin Huang, Bolei Zhou, and Cewu Lu. Recurrent residual module for fast inference in videos. CoRR, abs/1802.09723, 2018.
Viorica Patraucean, Ankur Handa, and Roberto Cipolla. Spatio-temporal video autoencoder with differentiable memory. CoRR, abs/1511.06309, 2015.
Suchitra Ramachandran, Travis Meyer, and Carl R. Olson. Prediction suppression and surprise enhancement in monkey inferotemporal cortex. Journal of neurophysiology, 118 1:374–382, 2017.
Rajesh P. N. Rao and Dana H. Ballard. Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects. Nature neuroscience, 2 1:79–87, 1999.
Christian Schuldt, Ivan Laptev, and Barbara Caputo. Recognizing human actions: a local svm ¨ approach. Proceedings of the 17th International Conference on Pattern Recognition, 2004. ICPR 2004., 3:32–36 Vol.3, 2004.
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 NIPS, 2015.
Nitish Srivastava, Elman Mansimov, and Ruslan Salakhutdinov. Unsupervised learning of video representations using lstms. In ICML, 2015.
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. CoRR, abs/1707.04993, 2017.
S Ullman. Sequential seeking and counter streams: a computational model for bidirectional flow in the visual cortex. Cerebral Cortex, 5:1:1–1, 1995.
Laurens van der Maaten and Geoffrey E. Hinton. Visualizing data using t-sne. 2008.
Ruben Villegas, Jimei Yang, Yuliang Zou, Sungryull Sohn, Xunyu Lin, and Honglak Lee. Learning to generate long-term future via hierarchical prediction. In ICML, 2017.
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NIPS, 2016.
Yunbo Wang, Mingsheng Long, Jianmin Wang, Zhifeng Gao, and Philip S. Yu. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. In NIPS, 2017.
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 ICML, 2018.
Zhou Wang, Alan C. Bovik, Hamid R. Sheikh, and Eero P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing, 13:600–612, 2004.
Nevan Wichers, Ruben Villegas, Dumitru Erhan, and Honglak Lee. Hierarchical long-term video prediction without supervision. In ICML, 2018.
Shengjin Xu, Wanchen Jiang, Mu-Ming Poo, and Yang Dan. Activity recall in visual cortical ensemble. In Nature Neuroscience, 2012.
Ziru Xu, Yunbo Wang, Mingsheng Long, and Jianmin Wang. Predcnn: Predictive learning with cascade convolutions. In IJCAI, 2018.
Haishan Yao, Lei Shi, Feng Han, Hongfeng Gao, and Yang Dan. Rapid learning in cortical coding of visual scenes. Nature Neuroscience, 10:772–778, 2007.
# APPENDIX
# A 3D CONVOLUTIONAL LSTM
Because our data are in the unit of spatitemporal block, we have to use a 3D form of the 2D convolutional LSTM. 3D convolutional LSTM has been used by Choy et al. (2016) in the stereo setting. The dimensions of the input video or the various representations $[ , E $ and $H$ ) in any module are $c \times d \times h \times w$ , where $c$ is the number of channels, $d$ is the number of adjacent frames, $h$ and $w$ specify the spatial dimensions of the frame. The 3D spatiotemporal convolution kernel is $m \times k \times k$ in size, where $m$ is kernel temporal depth and $k$ is kernel spatial size. The spatial stride of the convolution is 1. The size of the output with $n$ kernels is $n \times d \times h \times w$ . We define the inputs as $X _ { 1 } , . . . , X _ { t }$ , the cell states as $C _ { 1 } , . . . , C _ { t }$ , the outputs as $H _ { 1 } , . . . , H _ { t }$ , and the gates as $i _ { t } , f _ { t } , o _ { t }$ . Our 3D convolutional LSTM is specified by the equations below, where the function of 3D convolution is indicated by $\star$ and the Hadamard product is indicated by $\circ$ .
$$\begin{array} { r l } & { i _ { t } = \sigma ( W _ { x i } \star X _ { t } + W _ { h i } \star H _ { t - 1 } + W _ { c i } \circ C _ { t - 1 } + b _ { i } ) } \\ & { f _ { t } = \sigma ( W _ { x f } \star X _ { t } + W _ { h f } \star H _ { t - 1 } + W _ { c f } \circ C _ { t - 1 } + b _ { f } ) } \\ & { C _ { t } = f _ { t } \circ C _ { t - 1 } + i _ { t } \circ t a n h ( W _ { x c } \star X _ { t } + W _ { h c } \star H _ { t - 1 } + b _ { c } ) } \\ & { o _ { t } = \sigma ( W _ { x o } \star X _ { t } + W _ { h o } \star H _ { t - 1 } + W _ { c o } \circ C _ { t } + b _ { o } ) } \\ & { H _ { t } = o _ { t } \circ t a n h ( C _ { t } ) } \end{array}$$
# B SEMANTIC CLUSTERING IN THE HIERARCHICAL REPRESENTATIONS
 Figure 7: Visualization of R representational units of the different modules in (a) a one-module network; (b)-(c) a two-module network; (d)-(f) a three-module network; and (g)-(j) a four-module network.
Figure 7 compares the t-SNE (van der Maaten & Hinton, 2008) projection of the responses of the R representation units in the center $8 \times 8$ “hypercolumns” of the different modules for networks of different number of modules to the 6 movement classes in the KTH dataset. Partial results are shown in Figure 5 of the main text of the paper. The figures demonstrate that as more higher order modules are stacked up in the hierarchy, the semantic clustering into the six movement classes become more pronounced even in the early modules, suggesting that the hierarchical interaction has steered the feature representation into semantic clusters even in the early modules. Module 4-1 means representation of module 1 in a 4-module network.
We use linear decoding (multi-class SVM) to assess the distinctiveness of the semantiuc clusters in the representation of the different modules in the different networks. The decoding results in Table 3 shows that the decoding accuracy based on the reprsentation of module 1 has improved from chance $( 1 6 \% )$ to $26 \%$ , an improvement of $60 \%$ between a 1-module HPNet and a 4-module HPNet, and that the representation of module 4 of a 4-module HPNet can achieve a $63 \%$ accuracy in classifying the six movement classes, suggesting that the network only needs to learn to predict unlabelled video sequences, and it automatically learns reasonable semantic representations for recognition.
Table 3: Our model’s decoding results of six movement classes in the KTH dataset based on R representations in different modules of networks of different number of modules. Module 4-2 means Module 2 of a 4-module HPNet.
<table><tr><td rowspan=1 colspan=1>Representation in</td><td rowspan=1 colspan=1>Module 1-1</td><td rowspan=1 colspan=1>Module 2-1</td><td rowspan=1 colspan=1>Module 3-1</td><td rowspan=1 colspan=1>Module 4-1</td></tr><tr><td rowspan=1 colspan=1>Mean decoding accuracy</td><td rowspan=1 colspan=1>0.16</td><td rowspan=1 colspan=1>0.19</td><td rowspan=1 colspan=1>0.21</td><td rowspan=1 colspan=1>0.26</td></tr><tr><td rowspan=1 colspan=1>Representation in</td><td rowspan=1 colspan=1>Module 4-1</td><td rowspan=1 colspan=1>Module 4-2</td><td rowspan=1 colspan=1>Module 4-3</td><td rowspan=1 colspan=1>Module 4-4</td></tr><tr><td rowspan=1 colspan=1>Mean decoding accuracy</td><td rowspan=1 colspan=1>0.26</td><td rowspan=1 colspan=1>0.45</td><td rowspan=1 colspan=1>0.57</td><td rowspan=1 colspan=1>0.63</td></tr></table>
For comparison, we also performed decoding on the output representations of each LSTM layer in the PredR $\mathrm { N N } { + } +$ and PredNet to study their representations of the six movement patterns. The results shown below indicate that the semantic clustering of the six movements is not very strong in the $\mathrm { P r e d R N N + + }$ hierarchy. We realized that this might be because the PredR $\mathrm { N N } { + } { + }$ behaves essentially like an autoencoder. The four-layer network effectively only has two layers of feature abstraction, with layer 2 being the most semantic in the hierarchy and layers 3 and 4 representing the unfolding of the feedback path. Decoding results indicate that the hierarchical representation based on the output of the LSTM at every layer in PredNet, which serve to predict errors of prediction errors of the previous layer, does not contain semantic information about the global movement patterns.
Table 4: PredR $\mathrm { N N } { + } { + }$ ’s decoding results of six movement classes in the KTH dataset based on representations in the different layers of the network.
<table><tr><td rowspan=1 colspan=1>Representation in</td><td rowspan=1 colspan=1>Layer 1</td><td rowspan=1 colspan=1>Layer 2</td><td rowspan=1 colspan=1>Layer 3</td><td rowspan=1 colspan=1>Layer 4</td></tr><tr><td rowspan=1 colspan=1>Mean decoding accuracy</td><td rowspan=1 colspan=1>0.18</td><td rowspan=1 colspan=1>0.23</td><td rowspan=1 colspan=1>0.18</td><td rowspan=1 colspan=1>0.16</td></tr></table>
Table 5: PredNet’s decoding results of six movement classes in the KTH dataset based on LSTM representations in the different layers of the network.
<table><tr><td rowspan=1 colspan=1>Representation in</td><td rowspan=1 colspan=1>Layer 1</td><td rowspan=1 colspan=1>Layer 2</td><td rowspan=1 colspan=1>Layer 3</td><td rowspan=1 colspan=1>Layer 4</td></tr><tr><td rowspan=1 colspan=1>Mean decoding accuracy</td><td rowspan=1 colspan=1>0.16</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>0.10</td><td rowspan=1 colspan=1>0.10</td></tr></table>
# C PREDICTION SUPPRESSION EFFECTS IN VIDEO SEQUENCE LEARNING IN HPNET
 Figure 8: Results of video sequence learning experiments showing prediction suppression can be observed in $E$ , $P$ , and $R$ units in every module along the hierarchical network. The abscissa is time after stimulus onset - where we set each video frame to be $2 5 ~ \mathrm { m s }$ for comparison with neural data. The ordinate is the normalized averaged temporal response of all the units within the center $8 \times 8$ hypercolumns, averaged across all neurons and across the 20 movies in the Predicted set (blue) and the Unpredicted set (red) respectively. Prediction suppression can be observed in all types of units, though more pronounced in the E and $\mathrm { \bf P }$ units.
# D PREDICTION SUPPRESSION EFFECT IN IT NEURONS AND HPNET
HPNet readily reproduces the prediction suppression effects observed in IT neurons. Meyer & Olson (2011) trained monkeys to image pairs in a fixed order for over 800 trials for each 8 pair images, and then compared the responses of the neurons to these images in the trained order against the responses of the neurons to the same images but in novel pairings. Figure 9 shows the mean responses of 81 IT neurons during testing stage for predicted pairs and unpredicted pairs. All the stimuli are presented in both pairs. They found that neural responses to the expected second images in a familiar sequence order is much weaker than the neural responses to the image in an unfamiliar or unexpected sequence order. To evaluate whether HPNet can produce the same effect, we performed exactly the same experiments with 2000 epochs of training on the image pairs, with a gap of 2 frames, and our model produced the same results, with lower responses for the predicted second stimulus relative to the unpredicted second stimulus. Each stimulus sequence was presented first with 5 gray frames, followed by 10 frames of the first image in the pair, then 2 gray frames as gap, then 10 frames of the second image in the pair. The responses of the units to the trained set and the untrained set are the same prior to training. After training, the images when arranged in the trained order responded much less after the initial responses than the same images but arranged in unpredicted pairs. The result shown in Figure 10 duplicated the observations in Meyer & Olson (2011), the average neural response of $E$ unit is lower than the unpredicted pairs. All three types of units of NPNet exhibit prediction suppression though the effect is much weaker for the R units (see Figure 11. Lotter et al. (2018) also tested the prediction suppression effect, but their model couldn’t allow any gap between the stimuli as in the experiment. Our model can handle gap because of our model is processing information in spatiotemporal blocks.
 Figure 9: Prediction suppression in IT neurons ((Meyer & Olson, 2011)).
 Figure 10: Prediction suppression results on $E 4$ units in HPNet.
 Figure 11: Prediction suppression behaviors in the E, P, and R units of module 4 of HPNet, respectively.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331# REFERENCE-AWARE LANGUAGE MODELS
Zichao $\mathbf { Y a n g ^ { 1 * } }$ ∗, Phil Blunsom2,3, Chris Dyer1,2, and Wang Ling2 1Carnegie Mellon University, 2DeepMind, and 3University of Oxford zichaoy@cs.cmu.edu, {pblunsom,cdyer,lingwang}@google.com
# ABSTRACT
We propose a general class of language models that treat reference as an explicit stochastic latent variable. This architecture allows models to create mentions of entities and their attributes by accessing external databases (required by, e.g., dialogue generation and recipe generation) and internal state (required by, e.g. language models which are aware of coreference). This facilitates the incorporation of information that can be accessed in predictable locations in databases or discourse context, even when the targets of the reference may be rare words. Experiments on three tasks show our model variants outperform models based on deterministic attention.
# 1 INTRODUCTION
Referring expressions (REs) in natural language are noun phrases (proper nouns, common nouns, and pronouns) that identify objects, entities, and events in an environment. REs occur frequently and they play a key role in communicating information efficiently. While REs are common, previous works neglect to model REs explicitly, either treating REs as ordinary words in the model or replacing them with special tokens. Here we propose a language modeling framework that explicitly incorporates reference decisions.
In Figure 1 we list examples of REs in the context of the three tasks that we consider in this work. Firstly, reference to a database is crucial in many applications. One example is in task oriented dialogue where access to a database is necessary to answer a user’s query (Young et al., 2013; Li et al., 2016; Vinyals & Le, 2015; Wen et al., 2015; Sordoni et al., 2015; Serban et al., 2016; Bordes & Weston, 2016; Williams & Zweig, 2016; Shang et al., 2015; Wen et al., 2016). Here we consider the domain of restaurant recommendation where a system refers to restaurants (name) and their attributes (address, phone number etc) in its responses. When the system says “the nirala is a nice restaurant”, it refers to the restaurant name the nirala from the database. Secondly, many models need to refer to a list of items (Kiddon et al., 2016; Wen et al., 2015). In the task of recipe generation from a list of ingredients (Kiddon et al., 2016), the generation of the recipe will frequently reference these items. As shown in Figure 1, in the recipe “Blend soy milk and . . . ”, soy milk refers to the ingredient summaries. Finally, we address references within a document (Mikolov et al., 2010; Ji et al., 2015; Wang & Cho, 2015), as the generation of words will ofter refer to previously generated words. For instance the same entity will often be referred to throughout a document. In Figure 1, the entity you refers to I in a previous utterance.
In this work we develop a language model that has a specific module for generating REs. A series of latent decisions (should I generate a RE? If yes, which entity in the context should I refer to? How should the RE be rendered?) augment a traditional recurrent neural network language model and the two components are combined as a mixture model. Selecting an entity in context is similar to familiar models of attention (Bahdanau et al., 2014), but rather than being a deterministic function that reweights representations of elements in the context, it is treated as a distribution over contextual elements which are stochastically selected and then copied or, if the task warrants it, transformed (e.g., a pronoun rather than a proper name is produced as output). Two variants are possible for updating the RNN state: one that only looks at the generated output form; and a second that looks at values of the latent variables. The former admits trivial unsupervised learning, latent decisions are conditionally independent of each other given observed context, whereas the latter enables more expressive models that can extract information from the entity that is being referred to. In each of the three tasks, we demonstrate our reference aware model’s efficacy in evaluations against models that do not explicitly include a reference operation.
 Figure 1: Reference-aware language models.
Our contributions are as follows:
• We propose a general framework to model reference in language and instantiate it in the context of dialogue modeling, recipe generation and coreference based language models. • We build three data sets to test our models. There lack existing data sets that satisfy our need, so we build these data sets ourselves. These data sets are either built on top existing data set (we constructed the table for DSTC2 data set for dialogue evaluation), crawled from websites (we crawled all recipes in www.allrecipes.com) or annotated with NLP tools (we annotate the coreference with Gigaword corpus for our evaluation). • We perform comprehensive evaluation of our models on the three data sets and verify our models perform better than strong baselines.
# 2 REFERENCE-AWARE LANGUAGE MODELS
Here we propose a general framework for reference-aware language models.
We denote each document as a series of tokens $x _ { 1 } , \ldots , x _ { L }$ , where $L$ is the number of tokens in the document. Our goal is to maximize the probabilities $p ( x _ { i } \mid c _ { i } )$ , for each word in the document based on its previous context $c _ { i } = x _ { 1 } , \ldots , x _ { i - 1 }$ . In contrast to traditional neural language models, we introduce a variable at each position $z _ { i }$ , which controls the decision on which source $x _ { i }$ is generated from. The token conditional probably is then obtained by:
$$p ( x _ { i } \mid c _ { i } ) = p ( x _ { i } \mid z _ { i } , c _ { i } ) p ( z _ { i } \mid c _ { i } ) .$$
In dialogue modeling and recipe generation, $z _ { i }$ will simply taken on values in $\{ 0 , 1 \}$ . Where $z _ { i } = 1$ denotes that $x _ { i }$ is generated as a reference, either to a database entry or an item in a list. However, $z _ { i }$ can also be defined as a distribution over previous entities, allowing the model to predict $x _ { i }$ conditioned on its a previous mention word. This will be the focus of the coreference language model. When $z _ { i }$ is not observed (which it generally will not be), we will train our model to maximize the marginal probability in Eq. 1 directly.
# 2.1 DIALOGUE MODEL WITH DATABASE SUPPORT
We first apply our model on task-oriented dialogue systems in the domain of restaurant recommendations, and work on the data set from the second Dialogue State Tracking Challenge (DSTC2) (Henderson et al., 2014). Table. 1 is one example dialogue from this dataset.
We can observe from this example, users get recommendations of restaurants based on queries that specify the area, price and food type of the restaurant. We can support the system’s decisions by incorporating a mechanism that allows the model to query the database allowing the model to find restaurants that satisfy the users queries. Thus, we crawled TripAdvisor for restaurants in the
M: Hello , welcome to the Cambridge restaurant system? You can ask for restaurants by area, price range or food type . How may I help you? U: i want a moderately priced restaurant in the north town M: the nirala is a nice restaurant in the north of town in the moderate price range U: what is the address M: Sure , the nirala is on 7 Milton Road Chesterton
Table 1: Example dialogue, M stands for Machine and U stands for User Table 2: Fragment of database for dialogue system.
<table><tr><td rowspan=1 colspan=1>NAME</td><td rowspan=1 colspan=1>PRICE RANGE</td><td rowspan=1 colspan=1>FOOD</td><td rowspan=1 colspan=1>AREA</td><td rowspan=1 colspan=1>ADDRESS</td><td rowspan=1 colspan=1>POST CODE</td><td rowspan=1 colspan=1>PHONE</td></tr><tr><td rowspan=1 colspan=1>ali baba</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>lebanese</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>59 Hills Road City Cen-tre</td><td rowspan=1 colspan=1>CB 2,1NT</td><td rowspan=1 colspan=1>01462 432565</td></tr><tr><td rowspan=1 colspan=1>thenirala</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>north</td><td rowspan=1 colspan=1>7 Milton Road Chester-ton</td><td rowspan=1 colspan=1>CB 4,1 UY</td><td rowspan=1 colspan=1>01223 360966</td></tr></table>
Cambridge area, where the dialog dataset was collected. Then, we remove restaurants that do not appear in the data set and create a database with 109 entries with restaurants and their attributes (e.g. food type). A sample of our database is shown in Table. 2. We can observe that each restaurant contains 6 attributes that are generally referred in the dialogue dataset. As such, if the user requests a restaurant that serves “indian” food, we wish to train a model that can search for entries whose “food” column contains “indian”. Now, we describe how we deploy a model that fulfills these requirements.
# 2.1.1 DIALOGUE MODEL
 Figure 2: Hierarchical RNN Seq2Seq model
We build a model based on the hierarchical RNN model described in (Serban et al., 2016), as in dialogues, the generation of the response is not only dependent on the previous sentence, but on all sentences leading to the response. We assume that a dialogue is alternated between a machine and a user. An illustration of the model is shown in Figure 2.
Consider a dialogue with $T$ turns, and the utterance from a user is denoted as $X = \{ x _ { i } \} _ { i = 1 } ^ { T }$ , where $i$ is the $i$ -th utterance, whereas the utterance from a machine is denoted as ${ \cal Y } = \{ y _ { i } \} _ { i = 1 } ^ { T }$ , where $i$ is the $i$ -th utterance. We define $x _ { i } = \{ x _ { i j } \} _ { j = 1 } ^ { | x _ { i } | }$ , $y _ { i } = \{ y _ { i v } \} _ { v = 1 } ^ { | y _ { i } | }$ , where $x _ { i j }$ denotes the $j$ -th token in the $i$ -th utterance from the user, whereas $y _ { i v }$ denotes the $v$ -th token in the $i$ -th utterance from the machine. Finally, $\left| x _ { i } \right|$ and $| y _ { i } |$ denote the number of tokens in the user and machine utterances, respectively. The dialogue sequence starts with machine utterance $\left\{ y _ { 1 } , x _ { 1 } , y _ { 2 } , x _ { 2 } , \dots , y _ { T } , x _ { T } \right\}$ . We would like to model the utterances from the machine
$$p ( y _ { 1 } , y _ { 2 } , \ldots , y _ { T } | x _ { 1 } , x _ { 2 } , \ldots , x _ { T } ) = \prod _ { i } p ( y _ { i } | y _ { < i } , x _ { < i } ) = \prod _ { i , v } p ( y _ { i , v } | y _ { i , < v } , y _ { < i } , x _ { < i } ) ,$$
where $y _ { < i }$ denotes all the utterances before $i$ and $y _ { i , < v }$ denotes the first $v - 1$ tokens in the $i$ -th utterance of the machine. A neural model is employed to predict $p ( y _ { i , v } | y _ { i , < v } , y _ { < i } , x _ { < i } )$ , which operates as follows:
Sentence Encoder: We first encode previous utterances $y _ { < i }$ and $x _ { < i }$ into continuous space by generatistate mploying a LSTM encodand apply the recursion $x _ { i }$ , and sta, where he initial LSTMdenotes a word $h _ { i , 0 } ^ { x }$ $h _ { i , j } ^ { x } = \mathrm { L S T M } _ { \mathrm { E } } ^ { - } ( W _ { E } x _ { i , j } , h _ { i , j - 1 } ^ { x } )$ $W _ { E } x _ { i , j }$
embedding lookup for the token $x _ { i , j }$ , and $\mathbf { L S T M _ { E } }$ denotes the LSTM transition function described in Hochreiter & Schmidhuber (1997). The representation of the user utterance is represented by the final LSTM state $h _ { i } ^ { x } \ = \ h _ { i , | x _ { i } | } ^ { x }$ The same process is applied to obtain the machine utterance representation $h _ { i } ^ { y } = h _ { i , | y _ { i } | } ^ { y }$ hyi,|yi|
Turn Encoder: Then, combine all the representations of all the utterances with a second LSTM, which encodes the sequence $\{ h _ { 1 } ^ { y } , h _ { 1 } ^ { x } , . . . , h _ { i } ^ { \bar { y } } , h _ { i } ^ { x } \}$ into a continuous vector. Once again, we start with an initial state $u _ { 0 }$ and feed each of the utterance representation to obtain the following LSTM state, until the final state is obtained. For simplicity, we shall refer to this as $u _ { i }$ , which can be seen as the hierarchical encoding of the previous $i$ utterances.
Seq2Seq Decoder: As for decoding, in order to generate each utterance $y _ { i }$ , we can feed $u _ { i - 1 }$ into the decoder LSTM as the initial state $s _ { i , 0 } = u _ { i - 1 }$ and decode each token in $y _ { i }$ . Thus, we can express the decoder as:
$$\begin{array} { r l } & { s _ { i , v } ^ { y } = \mathrm { L S T M } _ { \mathrm { D } } ( W _ { E } y _ { i , v - 1 } , s _ { i , v - 1 } ) , } \\ & { p _ { i , v } ^ { y } = \mathrm { s o f t m a x } ( W s _ { i , v } ^ { y } ) , } \end{array}$$
where the desired probability $p ( y _ { i , v } | y _ { i , < v } , y _ { < i } , x _ { < i } )$ is expressed by $p _ { i , v } ^ { y }$
Attention based decoder: We can also incorporate the attention mechanism in our hierarchical model. An attention model builds a representation $d$ by averaging over a set of vectors $p$ . We define the attention function as $a = \mathrm { A T T N } ( p , q )$ , where $a$ is a probability distribution over the set of vectors $p$ , conditioned on any input representation $q$ . A full description of this operation is described in (Bahon the current decoder state danau et al., 2014). Thus, for each generated token $s _ { i , v } ^ { y }$ , obtaining the attentions over input tokens from previous turn $y _ { i , v }$ , we compute the attentions $a _ { i , v }$ , conditioned $( i - 1 )$ . We denote the vector of all tokens in previous turn as $h _ { i - 1 } ^ { x , y } = [ \{ h _ { i - 1 , j } ^ { x } \} _ { j = 1 } ^ { | x _ { i - 1 } | } , \{ h _ { i - 1 , v } ^ { y } \} _ { v = 1 } ^ { | y _ { i - 1 } | } ]$ }|yi−1|] Let . $K = | h _ { i - 1 } ^ { x , y } |$ be the number of tokens in previous turn. Thus, we obtain the attention probabilities − over all previous tokens $a _ { i , v }$ as $\mathrm { A T T N } ( s _ { i , v } ^ { y } , h _ { i - 1 } ^ { x , y } )$ . Then, the weighted sum is computed over these probabilities $\begin{array} { r } { d _ { i , v } = \sum _ { k \in K } a _ { i , v , k } h _ { i - 1 , k } ^ { x , y } } \end{array}$ , where $_ { a _ { i , v , k } }$ is the probability of aligning to the $k$ -th token from previous turn. The resulting vector $d _ { i , v }$ is used to obtain the probability of the following word $p _ { i , v } ^ { y }$ . Thus, we express the decoder as:
$$\begin{array} { r l } & { s _ { i , v } ^ { y } = \mathrm { L S T M } _ { \mathrm { D } } ( [ { W } _ { \mathrm { E } } y _ { i , v - 1 } , d _ { i , v - 1 } ] , s _ { i , v - 1 } ) , } \\ & { a _ { i , v } = \mathrm { A T T N } ( h _ { i - 1 } ^ { x , y } , s _ { i , v } ^ { y } ) , } \\ & { d _ { i , v } = \displaystyle \sum _ { k \in K } a _ { i , v , k } h _ { i - 1 , k } ^ { x , y } , } \\ & { p _ { i , v } ^ { y } = \mathrm { s o f t m a x } ( W [ s _ { i , v } ^ { y } , d _ { i , v } ] ) . } \end{array}$$
# 2.1.2 INCORPORATING TABLE ATTENTION
 Figure 3: Table based decoder.
We now extend the attention model in order to allow the attention to be computed over a table, allowing the model to condition the generation on a database.
We denote a table with $R$ rows and $C$ columns as $\{ f _ { r , c } \} , r \in [ 1 , R ] , c \in [ 1 , C ]$ , where $f _ { r , c }$ is the cell in row $r$ and column $c$ . The attribute of each column is denoted as $s _ { c }$ , where $c$ is the $c$ -th attribute. $f _ { r , c }$ and $s _ { c }$ are one-hot vector.
Table Encoding: To encode the table, we build an attribute vector $g _ { c }$ for each column. For each cell $f _ { r , c }$ of the table, we concatenate it with the corresponding attribute $g _ { c }$ and then feed it through a one-layer MLP as follows: $g _ { c } = W _ { E } s _ { c }$ and then $e _ { r , c } = \operatorname { t a n h } ( W [ W _ { E } f _ { r , c } , g _ { c } ] )$ .
Table Attention: The diagram for table attention is shown in Figure 3a. The attention over cells in the table is conditioned on a given vector $q$ , similarly to the attention model for sequences $\mathbf { A T T N } ( p , q )$ . However, rather than a sequence $p$ , we now operate over a table $f$ . Our attention model computes a attribute attention followed by row attention of the table. We first use the attention mechanism on the attributes to find out which attribute the user asks about. Suppose a user says cheap, then we should focus on the price attribute. After we get the attention probability $p ^ { a } = \mathrm { A T T N } ( \{ g _ { c } \} , q )$ , over the attribute, we calculate the weighted representation for each row $\begin{array} { r } { e _ { r } = \sum _ { c } p _ { c } ^ { a } e _ { r c } } \end{array}$ conditioned on $p ^ { a }$ . Then $e _ { r }$ has the price information of each row. We further use attention mechanism on $e _ { r }$ and get the probability $p ^ { r } \bar { \mathbf { \Psi } } = \mathrm { A T T N } ( \{ e _ { r } \} , q )$ over the rows. Then restaurants with cheap price will be picked. Then, using the probabilities $p ^ { r }$ , we compute the weighted average over the all rows $\begin{array} { r } { e _ { c } = \sum _ { r } p _ { r } ^ { r } e _ { r , c } } \end{array}$ , which is used in the decoder. The detailed process is:
$$\begin{array} { r l r } { { p _ { a } = \mathrm { A T T N } ( \{ g _ { c } \} , q ) , } } \\ & { } & { \quad e _ { r } = \displaystyle \sum _ { c } p _ { c } ^ { a } e _ { r c } \quad \forall r , } \\ & { } & { \quad p _ { r } = \mathrm { A T T N } ( \{ e _ { r } \} , q ) , } \\ & { } & { \quad e _ { c } = \displaystyle \sum _ { r } p _ { r } ^ { r } e _ { r , c } \quad \forall c . } \end{array}$$
This is embedded in the decoder by replacing the conditioned state as the current decoder state $s _ { i , 0 } ^ { y }$ and then at each step, conditioning the prediction of ach step. The detailed diagram of table attention is s $y _ { i , v }$ on n in $\{ e _ { c } \}$ by using attention mechanismre 3a.
# 2.1.3 INCORPORATING TABLE POINTER NETWORKS
We now describe the mechanism used to refer to specific database entries during decoding. At each timestep, the model needs to decide whether to generate the next token from an entry of the database or from the word softmax. This is performed as follows.
Pointer Switch: We use $z _ { i , v } \in [ 0 , 1 ]$ to denote the decision of whether to copy one cell from the table. We compute this probability as follows:
$$p ( z _ { i , v } | s _ { i , v } ) = \mathrm { s i g m o i d } ( W [ s _ { i , v } , d _ { i , v } ] ) .$$
Thus, if $z _ { i , v } = 1$ , the next token $y _ { i , v }$ will be generated from the database, whereas if $z _ { i , v } = 0$ , then the following token is generated from a softmax. We shall now describe how we generate tokens from the database.
Table Pointer: If $z _ { i , v } = 1$ , the token is generated from the table. The detailed process of calculating the probability distribution over the table is shown in Figure 3b. This is similar to the attention mechanism, except that we perform a column attention to compute the probabilities of copying from each column after Equation. 5. More formally:
$$\begin{array} { c } { { p ^ { c } = \mathrm { A T T N } ( \{ e _ { c } \} , q ) , } } \\ { { p ^ { \mathrm { c o p y } } = p ^ { r } \otimes p ^ { c } , } } \end{array}$$
where $p ^ { c }$ is a probability distribution over columns, whereas $p ^ { r }$ is a probability distribution over rows. In order to compute a matrix with the probability of copying each cell, we simply compute the outer product $p ^ { \mathrm { c o p y } } = p ^ { r } \otimes p ^ { c }$ .
Objective: As we treat $z _ { i }$ as a latent variable, we wish to maximize the marginal probability of the sequence $y _ { i }$ over all possible values of $z _ { i }$ . Thus, our objective function is defined as:
$$p ( y _ { i , v } | s _ { i , v } ) = p ^ { \mathrm { v o c a b } } p ( 0 | s _ { i , v } ) + p ^ { \mathrm { c o p y } } p ( 1 | s _ { i , v } ) = p ^ { \mathrm { v o c a b } } ( 1 - p ( 1 | s _ { i , v } ) ) + p ^ { \mathrm { c o p y } } p ( 1 | s _ { i , v } ) .$$
The model can also be trained in a fully supervised fashion, if $z _ { i , v }$ is observed. In such cases, we simply maximize the likelihood of $p ( z _ { i , v } | s _ { i , v } )$ , based on the observations, rather than using the marginal probability over $z _ { i , v }$ .
# 2.2 RECIPE GENERATION
Table 3: Ingredients and recipe for Spinach and Banana Power Smoothie.
<table><tr><td>ingredients</td><td>recipe</td></tr><tr><td>1 cup plain soy milk 3/4 cup packed fresh spinach leaves 1 large banana, sliced</td><td>Blend soy milk and spinach leaves together in a blender until smooth. Add banana and pulse until thoroughly blended.</td></tr></table>
Next, we consider the task of recipe generation conditioning on the ingredient lists. In this task, we must generate the recipe from a list of ingredients. Table. 3 illustrates the ingredient list and recipe for Spinach and Banana Power Smoothie. We can see that the ingredients soy milk, spinach leaves, and banana occur in the recipe.
 Figure 4: Recipe pointer
Let the ingredients of a recipe be $X ~ = ~ \{ x _ { i } \} _ { i = 1 } ^ { T }$ and each ingredient contains $L$ tokens $\begin{array} { r l } { x _ { i } } & { { } = } \end{array}$ $\{ x _ { i j } \} _ { j = 1 } ^ { L }$ . The corresponding recipe is $y = \{ y _ { v } \} _ { v = 1 } ^ { K }$ . We first use a LSTM to encode each ingredient:
$$h _ { i , j } = \mathrm { L S T M } _ { \mathrm { E } } ( W _ { E } x _ { i j } , h _ { i , j - 1 } ) \quad \forall i .$$
Then, we sum the resulting state of each ingredient to obtain the starting LSTM state of the decoder. Once again we use an attention based decoder:
$$\begin{array} { c } { { s _ { v } = \mathrm { L S T M } _ { \mathrm { D } } \displaystyle ( s _ { v - 1 } , d _ { v - 1 } , W _ { \mathrm { E } } y _ { v - 1 } ) , } } \\ { { p _ { v } ^ { \mathrm { c o p y } } = \mathrm { A T T N } \displaystyle ( \{ \left\{ h _ { i , j } \right\} _ { i = 1 } ^ { T } \} _ { j = 1 } ^ { L } , s _ { v } ) , } } \\ { { d _ { v } = \displaystyle \sum _ { i j } p _ { v , i , j } h _ { i , j } , } } \\ { { p ( z _ { v } | s _ { v } ) = \mathrm { s i g m o i d } ( W [ s _ { v } , d _ { v } ] ) , } } \\ { { p _ { v } ^ { \mathrm { v o c a b } } = \mathrm { s o f t m a x } ( W [ s _ { v } , d _ { v } ] ) . } } \end{array}$$
Similar to the previous task, the decision to copy from the ingredient list or generate a new word from the softmax is performed using a switch, denoted as $p ( z _ { v } | s _ { v } )$ . We can obtain a copying each of the words in the ingredients by computing in the attention mechanism. For training, we optimize the $p _ { v } ^ { \mathrm { c o p y } } =$ $\mathsf { \bar { A } T T N } ( \{ \{ \bar { h } _ { i , j } \} _ { i = 1 } ^ { T } \} _ { j = 1 } ^ { L } , s _ { v } )$ likelihood function employed in the previous task.
# 2.3 COREFERENCE BASED LANGUAGE MODEL
Finally, we build a language model that uses coreference links to point to previous words. Before generating a word, we first make the decision on whether it is an entity mention. If so, we decide which entity this mention belongs to, then we generate the word based on that entity. Denote the document as $X = \{ x _ { i } \} _ { i = 1 } ^ { L }$ , and the entities are $E = \{ e _ { i } \} _ { i = 1 } ^ { N }$ , each entity has $M _ { i }$ mentions, $e _ { i } =$ $\{ m _ { i j } \} _ { j = 1 } ^ { M _ { i } }$ , such that $\{ x _ { m _ { i j } } \} _ { j = 1 } ^ { M _ { i } }$ refer to the same entity. We use a LSTM to model the document, the hidden state of each token is $h _ { i } = \mathrm { L S T M } ( W _ { E } x _ { i } , h _ { i - 1 } )$ . We use a set $h ^ { e } = \{ h _ { 0 } ^ { e } , h _ { 1 } ^ { e } , . . . , h _ { M } ^ { e } \}$ to keep track of the entity states, where $h _ { j } ^ { e }$ is the state of entity $j$ .
um and $[ \mathrm { I l } _ { 1 }$ think that is whats - Go ahead [Linda]2. Well and thanks goes to $[ \mathrm { y o u l } _ { 1 }$ and to [the media]3 to help $[ \mathrm { u s } ] _ { 4 } . . . \mathrm { S o } [ \mathrm { o u r } ] _ { 4 }$ hat is off to all of [you]5...
 Figure 5: Coreference based language model, example taken from Wiseman et al. (2016).
Word generation: At each time step before generating the next word, we predict whether the word is an entity mention:
$$\begin{array} { r l r } { { p ^ { \mathrm { c o r e f } } ( v _ { i } | h _ { i - 1 } , h ^ { e } ) = \mathrm { A T T N } ( h ^ { e } , h _ { i - 1 } ) , } } \\ & { } & { d _ { i } = \sum _ { v _ { i } } p ( v _ { i } ) h _ { v _ { i } } ^ { e } } \\ & { } & { p ( z _ { i } | h _ { i - 1 } ) = \mathrm { s i g m o i d } ( W [ d _ { i } , h _ { i - 1 } ] ) , } \end{array}$$
where $z _ { i }$ denotes whether the next word is an entity and if yes $v _ { i }$ denotes which entity the next word corefers to. If the next word is an entity mention, then $p ( x _ { i } | v _ { i } , h _ { i - 1 } , h ^ { e } ) =$ softmax $( W _ { 1 } \operatorname { t a n h } ( W _ { 2 } [ h _ { v _ { i } } ^ { e } , h _ { i - 1 } ] ) )$ else $p ( x _ { i } | h _ { i - 1 } ) = \mathrm { s o f t m a x } ( W _ { 1 } h _ { i - 1 } )$ ,
$$p ( x _ { i } | x _ { < i } ) = \left\{ \begin{array} { l l } { p ( x _ { i } | h _ { i - 1 } ) p ( z _ { i } | h _ { i - 1 } , h ^ { e } ) } & { \quad \mathrm { i f } \quad z _ { i } = 0 . } \\ { p ( x _ { i } | v _ { i } , h _ { i - 1 } , h ^ { e } ) p ^ { \mathrm { c o r e f } } ( v _ { i } | h _ { i - 1 } , h ^ { e } ) p ( z _ { i } | h _ { i - 1 } , h ^ { e } ) } & { \quad \mathrm { i f } \quad z _ { i } = 1 . } \end{array} \right.$$
Entity state update: We update the entity state $h ^ { e }$ at each time step. In the beginning, $h ^ { e } = \{ h _ { 0 } ^ { e } \}$ , $h _ { 0 } ^ { e }$ denotes the state of an virtual empty entity and is a learnable variable. If $z _ { i } = 1$ and $v _ { i } = 0$ , then it indicates the next word is a new entity mention, then in the next step, we append $h _ { i }$ to $h ^ { e }$ , i.e., $h ^ { e } = \{ h ^ { e } , h _ { i } \}$ , if $e _ { i } > 0$ , then we update the corresponding entity state with the new hidden state, $h ^ { e } [ v _ { i } ] = h _ { i }$ . Another way to update the entity state is to use one LSTM to encode the mention states and get the new entity state. Here we use the latest entity mention state as the new entity state for simplicity. The detailed update process is shown in Figure 5.
# 3 EXPERIMENTS
# 4 DATA SETS AND PREPROCESSING
Dialogue: We use the DSTC2 data set. We only extracted the dialogue transcript from data set. There are about 3,200 dialogues in total. Since this is a small data set, we use 5-fold cross validation and report the average result over the 5 partitions. There may be multiple tokens in each table cell, for example in Table.2, the name, address, post code and phone number have multiple tokens, we replace them with one special token. For the name, address, post code and phone number of the $j$ -th row, we replace the tokens in each cell with NAME $j$ , ADDR $j$ , POSTCODE $j$ , PHONE $j$ . If a table cell is empty, we replace it with an empty token EMPTY. We do a string match in the transcript and replace the corresponding tokens in transcripts from the table with the special tokens.
Each dialogue on average has 8 turns (16 sentences). We use a vocabulary size of 900, including about 400 table tokens and 500 words.
Recipes: We crawl all recipes from www.allrecipes.com. There are about 31, 000 recipes in total, and every recipe has a ingredient list and a corresponding recipe. We exclude the recipes that have less than 10 tokens or more than 500 tokens, those recipes take about $0 . 1 \%$ of all data set. On average each recipe has 118 tokens and 9 ingredients. We random shuffle the whole data set and take $80 \%$ as training and $10 \%$ for validation and test. We use a vocabulary size of 10,000 in the model.
Coref LM: We use the Xinhua News data set from Gigaword Fifth Edition and sample 100,000 documents from it that has length in range from 100 to 500. Each document has on average 234 tokens, so there are 23 million tokens in total. We use a tool to annotate all the entity mentions and use the annotation in the training. We take $80 \%$ as training and $10 \%$ as validation and test respectively. We ignore the entities that have only one mention and for the mentions that have multiple tokens, we take the token that is most frequent in the all the mentions for this entity. After the preprocessing, tokens that are entity mentions take about $10 \%$ of all tokens. We use a vocabulary size of 50,000 in the model.
# 4.1 MODEL TRAINING AND EVALUATION
We train all models with simple stochastic gradient descent with clipping. We use a one-layer LSTM for all RNN components. Hyper-parameters are selected using grid search based on the validation set. We use dropout after the input embedding and LSTM output. The learning rate is selected from [0.1, 0.2, 0.5, 1], maximum gradient norm is selected from [1, 2, 5, 10] and drop ratio is selected from [0.2, 0.3, 0.5]. The batch size and LSTM dimension size is slightly different for different tasks so as to make the model fit into memory. The number of epochs to train are different for each task and we drop the learning rate after reaching a given number of epochs. We report the per-word perplexity for all tasks, specifically, we report the perplexity of all words, words that can be generated from reference and non-reference words. For recipe generation, we also generate the recipe using beam size of 10 and evaluate the generated recipe with BLEU.
<table><tr><td>model</td><td>all</td><td>table</td><td>table oov</td><td>word</td></tr><tr><td>seq2seq</td><td>1.35±0.01</td><td>4.98±0.38</td><td>1.99E7±7.75E6</td><td>1.23±0.01</td></tr><tr><td>table attn</td><td>1.37±0.01</td><td>5.09±0.64</td><td>7.91E7±1.39E8</td><td>1.24±0.01</td></tr><tr><td>table pointer</td><td>1.33±0.01</td><td>3.99±0.36</td><td>1360 ± 2600</td><td>1.23±0.01</td></tr><tr><td>table latent</td><td>1.36±0.01</td><td>4.99±0.20</td><td>3.78E7±6.08E7</td><td>1.24±0.01</td></tr><tr><td colspan="5">+ sentence attn</td></tr><tr><td>seq2seq</td><td>1.28±0.01</td><td>3.31±0.21</td><td>2.83E9±4.69E9</td><td>1.19±0.01</td></tr><tr><td>table attn</td><td>1.28±0.01</td><td>3.17±0.21</td><td>1.67E7±9.5E6</td><td>1.20±0.01</td></tr><tr><td>table pointer</td><td>1.27±0.01</td><td>2.99±0.19</td><td>82.86±110</td><td>1.20±0.01</td></tr><tr><td>table latent</td><td>1.28±0.01</td><td>3.26±0.25</td><td>1.27E7±1.41E7</td><td>1.20±0.01</td></tr></table>
Table 4: Dialogue perplexity results. (All means all tokens, table means tokens from table, table oov denotes table tokens that does not appear in the training set, word means non-table tokens). sentence attn denotes we use attention mechanism over tokens from past turn. Table pointer and table latent differs in that table pointer, we provide supervised signal on when to generate a table token, while in table latent it is a latent decision.
<table><tr><td rowspan="3">model</td><td colspan="4">val</td><td colspan="4">test</td></tr><tr><td colspan="3">ppl</td><td rowspan="2">BLEU</td><td colspan="3">ppl</td><td rowspan="2">BLEU</td></tr><tr><td>all</td><td>ing</td><td>word</td><td>all</td><td>ing</td><td>word</td></tr><tr><td>seq2seq</td><td>5.60</td><td>11.26</td><td>5.00</td><td>14.07</td><td>5.52</td><td>11.26</td><td>4.91</td><td>14.39</td></tr><tr><td>attn</td><td>5.25</td><td>6.86</td><td>5.03</td><td>14.84</td><td>5.19</td><td>6.92</td><td>4.95</td><td>15.15</td></tr><tr><td>pointer</td><td>5.15</td><td>5.86</td><td>5.04</td><td>15.06</td><td>5.11</td><td>6.04</td><td>4.98</td><td>15.29</td></tr><tr><td>latent</td><td>5.02</td><td>5.10</td><td>5.01</td><td>14.87</td><td>4.97</td><td>5.19</td><td>4.94</td><td>15.41</td></tr></table>
Table 5: Recipe result, evaluated in perplexity and BLEU score. ing denotes tokens from recipe that appear in ingredients.
<table><tr><td rowspan="2">model</td><td colspan="3">val</td><td colspan="3">test</td></tr><tr><td>all</td><td>entity</td><td>word</td><td>all</td><td>entity</td><td>word</td></tr><tr><td>lm</td><td>33.08</td><td>44.52</td><td>32.04</td><td>33.08</td><td>43.86</td><td>32.10</td></tr><tr><td>pointer</td><td>32.57</td><td>32.07</td><td>32.62</td><td>32.62</td><td>32.07</td><td>32.69</td></tr><tr><td>pointer +init</td><td>30.43</td><td>28.56</td><td>30.63</td><td>30.42</td><td>28.56</td><td>30.66</td></tr></table>
Table 6: Coreference based LM. pointer $^ +$ init means we initialize the model with the LM weights.
# 4.2 RESULTS AND ANALYSIS
The results for dialogue, recipe generation and coref language model are shown in Table 4, 5 and 6 respectively. We can see from Table 4 that models that condition on table performs better in predicting table tokens in general. Table pointer has the lowest perplexity for token in the table. Since the table token appears rarely in the dialogue, the overall perplexity does not differ much and the non-table tokens perplexity are similar. With attention mechanism over the table, the perplexity of table token improves over basic seq2seq model, but not as good as directly pointing to cells in the table. As expected, using sentence attention improves significantly over models without sentence attention. Surprisingly, table latent performs much worse than table pointer. We also measure the perplexity of table tokens that appear only in test set. For models other than table pointer, because the tokens never appear in training set, the perplexity is quite high, while table pointer can predict these tokens much more accurately. The recipe results in Table 5 in general follows that findings from the dialogue. But the latent model performs better than pointer model since that tokens in ingredients that match with recipe does not necessarily come from the ingredients. Imposing a supervised signal will give wrong information to the model and hence make the result worse. Hence with latent decision, the model learns to when to copy and when to generate it from the vocabulary. The coref LM results are shown in Table 6. We find that coref based LM performs much better on the entities perplexities, but however is a little bit worse than for non-entity words. We found it is an optimization problem and perhaps the model is stuck in local optimum. So we initialize the pointer model with the weights learned from LM, the pointer model performs better than LM both for entity perplexity and non-entity words perplexity.
# 5 RELATED WORK
Recently, there has been great progresses in modeling languages based on neural network, including language modeling (Mikolov et al., 2010; Jozefowicz et al., 2016), machine translation (Sutskever et al., 2014; Bahdanau et al., 2014), question answering (Hermann et al., 2015) etc. Based on the success of seq2seq models, neural networks are applied in modeling chit-chat dialogue (Li et al., 2016; Vinyals & Le, 2015; Sordoni et al., 2015; Serban et al., 2016; Shang et al., 2015) and task oriented dialogue (Wen et al., 2015; Bordes & Weston, 2016; Williams & Zweig, 2016; Wen et al., 2016). Most of the chit-chat neural dialogue models are simply applying the seq2seq models. For the task oriented dialogues, most of them embed the seq2seq model in traditional dialogue systems, in which the table query part is not differentiable. while our model queries the database directly. Recipe generation was proposed in (Kiddon et al., 2016). Their model extents previous work on attention models (Allamanis et al., 2016) to checklists, whereas our work models explicit references to those checklists. Context dependent language models (Mikolov et al., 2010; Ji et al., 2015; Wang & Cho, 2015) are proposed to capture long term dependency of text. There are also lots of works on coreference resolution (Haghighi & Klein, 2010; Wiseman et al., 2016). We are the first to combine coreference with language modeling, to the best of our knowledge. Much effort has been invested in embedding a copying mechanism for neural models (Gulc¸ehre et al. ¨ , 2016; Gu et al., 2016; Ling et al., 2016). In general, a gating mechanism is employed to combine the softmax over observed words and a pointer network (Vinyals et al., 2015). These gates can be trained either by marginalizing over both outcomes, or using heuristics (e.g. copy low frequency words). Our models are similar to models proposed in (Ahn et al., 2016; Merity et al., 2016), where the generation of each word can be conditioned on a particular entry in knowledge lists and previous words. In our work, we describe a model with broader applications, allowing us to condition, on databases, lists and dynamic lists.
# 6 CONCLUSION
We introduce reference-aware language models which explicitly model the decision of from where to generate the token at each step. Our model can also learns the decision by treating it as a latent variable. We demonstrate on three tasks, table based dialogue modeling, recipe generation and coref based LM, that our model performs better than attention based model, which does not incorporate this decision explicitly. There are several directions to explore further based on our framework. The current evaluation method is based on perplexity and BLEU. In task oriented dialogues, we can also try human evaluation to see if the model can reply users’ query accurately. It is also interesting to use reinforcement learning to learn the actions in each step.
# REFERENCES
Sungjin Ahn, Heeyoul Choi, Tanel Parnamaa, and Yoshua Bengio. A neural knowledge language ¨ model. CoRR, abs/1608.00318, 2016.
Miltiadis Allamanis, Hao Peng, and Charles A. Sutton. A convolutional attention network for extreme summarization of source code. CoRR, abs/1602.03001, 2016. URL http://arxiv. org/abs/1602.03001.
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. URL http://arxiv.org/ abs/1409.0473.
Antoine Bordes and Jason Weston. Learning end-to-end goal-oriented dialog. arXiv preprint arXiv:1605.07683, 2016.
Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O. K. Li. Incorporating copying mechanism in sequence-to-sequence learning. CoRR, abs/1603.06393, 2016. URL http://arxiv.org/ abs/1603.06393.
C¸ aglar Gulc¸ehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing ¨ the unknown words. CoRR, abs/1603.08148, 2016. URL http://arxiv.org/abs/1603. 08148.
Aria Haghighi and Dan Klein. Coreference resolution in a modular, entity-centered model. In Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pp. 385–393. Association for Computational Linguistics, 2010.
Matthew Henderson, Blaise Thomson, and Jason Williams. Dialog state tracking challenge 2 & 3, 2014.
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems, pp. 1693–1701, 2015.
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735– 1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx. doi.org/10.1162/neco.1997.9.8.1735.
Yangfeng Ji, Trevor Cohn, Lingpeng Kong, Chris Dyer, and Jacob Eisenstein. Document context language models. arXiv preprint arXiv:1511.03962, 2015.
Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
Chloe Kiddon, Luke Zettlemoyer, and Yejin Choi. Globally coherent text generation with neural ´ checklist models. In Proc. EMNLP, 2016.
Jiwei Li, Will Monroe, Alan Ritter, Michel Galley, Jianfeng Gao, and Dan Jurafsky. Deep reinforcement learning for dialogue generation. In Proc. EMNLP, 2016.
Wang Ling, Edward Grefenstette, Karl Moritz Hermann, Toma´s Ko ˇ cisk ˇ y, Andrew Senior, Fumin ´ Wang, and Phil Blunsom. Latent predictor networks for code generation. In Proc. ACL, 2016.
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent \` neural network based language model. In Interspeech, volume 2, pp. 3, 2010.
Iulian V Serban, Alessandro Sordoni, Yoshua Bengio, Aaron Courville, and Joelle Pineau. Building end-to-end dialogue systems using generative hierarchical neural network models. In Proceedings of the 30th AAAI Conference on Artificial Intelligence (AAAI-16), 2016.
Lifeng Shang, Zhengdong Lu, and Hang Li. Neural responding machine for short-text conversation. arXiv preprint arXiv:1503.02364, 2015.
Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Meg Mitchell, JianYun Nie, Jianfeng Gao, and Bill Dolan. A neural network approach to context-sensitive generation of conversational responses. In Proc. NAACL, 2015.
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
Oriol Vinyals and Quoc V. Le. A neural conversational model. In Proc. ICML Deep Learning Workshop, 2015.
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Proc. NIPS, 2015.
Tian Wang and Kyunghyun Cho. Larger-context language modelling. arXiv preprint arXiv:1511.03729, 2015.
Tsung-Hsien Wen, Milica Gasic, Nikola Mrksic, Pei-hao Su, David Vandyke, and Steve J. Young. Semantically conditioned LSTM-based natural language generation for spoken dialogue systems. In Proc. EMNLP, 2015.
Tsung-Hsien Wen, Milica Gasic, Nikola Mrksic, Lina M Rojas-Barahona, Pei-Hao Su, Stefan Ultes, David Vandyke, and Steve Young. A network-based end-to-end trainable task-oriented dialogue system. arXiv preprint arXiv:1604.04562, 2016.
Jason D Williams and Geoffrey Zweig. End-to-end lstm-based dialog control optimized with supervised and reinforcement learning. arXiv preprint arXiv:1606.01269, 2016.
Sam Wiseman, Alexander M Rush, and Stuart M Shieber. Learning global features for coreference resolution. arXiv preprint arXiv:1604.03035, 2016.
Steve Young, Milica Gasiˇ c, Blaise Thomson, and Jason D Williams. Pomdp-based statistical spoken ´ dialog systems: A review. Proceedings of the IEEE, 101(5):1160–1179, 2013.
# A VISUALIZATION
M: Hello , welcome to the Cambridge restaurant system ? You can ask for restaurants by area , price range or food type . How may I help you ? U: and expensive restaurant that serves tuscan food M: Sorry there is no tuscan restaurant in the expensive price range U: french food M: cote is a great restaurant serving french food and it is in the expensive price range U: may i have the phone number M: The phone number of cote is 01223 311053 . U: thank you good bye M: Hello , welcome to the Cambridge restaurant system ? You can ask for restaurants by area , price range or food type . How may I help you ? U: cheap restaurant M: What kind of food would you like ? U: in the west part of town M: la margherita is a nice restaurant in the west of town in the cheap price range U: address M: Sure , la margherita is on 15 Magdalene Street City Centre U: thank you M: la margherita is a nice restaurant in the west of town in the cheap price range U: good bye
(a) Dialogue script
<table><tr><td rowspan=1 colspan=1>NAME</td><td rowspan=1 colspan=1>PRICE RANGE</td><td rowspan=1 colspan=1>FOOD</td><td rowspan=1 colspan=1>AREA</td><td rowspan=1 colspan=1>ADDRESS</td><td rowspan=1 colspan=1>POST CODE</td><td rowspan=1 colspan=1>PHONE</td></tr><tr><td rowspan=1 colspan=1>charlie chan</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>east</td><td rowspan=1 colspan=1>Regent Street City Cen-tre</td><td rowspan=1 colspan=1>C.B 2, 1 D.B</td><td rowspan=1 colspan=1>01223 361763</td></tr><tr><td rowspan=1 colspan=1>chiquito restau-rant bar</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>mexican</td><td rowspan=1 colspan=1>south</td><td rowspan=1 colspan=1>2G Cambridge LeisurePark Cherry HintonRoad Cherry Hinton</td><td rowspan=1 colspan=1>C.B 1,7D.Y</td><td rowspan=1 colspan=1>01223 400170</td></tr><tr><td rowspan=1 colspan=1>city stop</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>food</td><td rowspan=1 colspan=1>north</td><td rowspan=1 colspan=1>Cambridge City Foot-ball Club Milton RoadChesterton</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 363270</td></tr><tr><td rowspan=1 colspan=1>clowns cafe</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>italian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>C.B 1,1 L.N</td><td rowspan=1 colspan=1>01223 355711</td></tr><tr><td rowspan=1 colspan=1>cocum</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1>71 CastleStreet CityCentre</td><td rowspan=1 colspan=1>C.B 3,0 A.H</td><td rowspan=1 colspan=1>01223 366668</td></tr><tr><td rowspan=1 colspan=1>cote</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>french</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>Bridge Street City Cen-tre</td><td rowspan=1 colspan=1>C.B 2, 1U.F</td><td rowspan=1 colspan=1>01223 311053</td></tr><tr><td rowspan=1 colspan=1> curry garden</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>106 Regent Street CityCentre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 302330</td></tr><tr><td rowspan=1 colspan=1>curry king</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>5Jordans Yard BridgeStreet City Centre</td><td rowspan=1 colspan=1>C.B 1,2 B.D</td><td rowspan=1 colspan=1>01223 324351</td></tr><tr><td rowspan=1 colspan=1>curry prince</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>east</td><td rowspan=1 colspan=1>451 Newmarket RoadFen Ditton</td><td rowspan=1 colspan=1>C.B 5, 8 J.J</td><td rowspan=1 colspan=1>01223 566388</td></tr></table>
(b) Attention heat map: cote is a great restaurant serving french food and it is in the expensive price range. Table 7: Dialogue visualization 1
<table><tr><td rowspan=1 colspan=1>NAME</td><td rowspan=1 colspan=1>PRICERANGE</td><td rowspan=1 colspan=1>FOOD</td><td rowspan=1 colspan=1>AREA</td><td rowspan=1 colspan=1>ADDRESS</td><td rowspan=1 colspan=1>POST CODE</td><td rowspan=1 colspan=1>PHONE</td></tr><tr><td rowspan=1 colspan=1>charlie chan</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>east</td><td rowspan=1 colspan=1>Regent Street City Cen-tre</td><td rowspan=1 colspan=1>C.B 2,1 D.B</td><td rowspan=1 colspan=1>01223 361763</td></tr><tr><td rowspan=1 colspan=1>chiquito restau-rant bar</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>mexican</td><td rowspan=1 colspan=1>south</td><td rowspan=1 colspan=1>2G Cambridge LeisurePark Cherry HintonRoad CherryHinton</td><td rowspan=1 colspan=1>C.B 1,7D.Y</td><td rowspan=1 colspan=1>01223 400170</td></tr><tr><td rowspan=1 colspan=1>city stop</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>food</td><td rowspan=1 colspan=1>north</td><td rowspan=1 colspan=1>Cambridge City Foot-ball Club Milton RoadChesterton</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 363270</td></tr><tr><td rowspan=1 colspan=1>clowns cafe</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>italian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>C.B1, 1 L.N</td><td rowspan=1 colspan=1>01223 355711</td></tr><tr><td rowspan=1 colspan=1>cocum</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1>71 CastleStreet CityCentre</td><td rowspan=1 colspan=1>C.B 3,0 A.H</td><td rowspan=1 colspan=1>01223 366668</td></tr><tr><td rowspan=1 colspan=1>cote</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>french</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>Bridge Street City Cen-tre</td><td rowspan=1 colspan=1>C.B 2,1 U.F</td><td rowspan=1 colspan=1>01223 311053</td></tr><tr><td rowspan=1 colspan=1>curry garden</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>106 Regent Street CityCentre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223302330</td></tr><tr><td rowspan=1 colspan=1> curry king</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>5Jordans Yard BridgeStreet City Centre</td><td rowspan=1 colspan=1>C.B1,2 B.D</td><td rowspan=1 colspan=1>01223 324351</td></tr><tr><td rowspan=1 colspan=1>curry prince</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>east</td><td rowspan=1 colspan=1>451 Newmarket RoadFen Ditton</td><td rowspan=1 colspan=1>C.B 5, 8 J.J</td><td rowspan=1 colspan=1>01223 566388</td></tr></table>
(c) Attention heap map: The phone number of cote is 01223 311053 .
(a) Dialogue script
<table><tr><td rowspan=1 colspan=1>NAME</td><td rowspan=1 colspan=1>PRICE RANGE</td><td rowspan=1 colspan=1>FOOD</td><td rowspan=1 colspan=1>AREA</td><td rowspan=1 colspan=1>ADDRESS</td><td rowspan=1 colspan=1>POST CODE</td><td rowspan=1 colspan=1>PHONE</td></tr><tr><td rowspan=1 colspan=1>india house</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1>31Newnham RoadNewnham</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 461661</td></tr><tr><td rowspan=1 colspan=1>j restaurant</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>oriental</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>86Regent Street CityCentre</td><td rowspan=1 colspan=1>C.B 2,1 D.P</td><td rowspan=1 colspan=1>01223 307581</td></tr><tr><td rowspan=1 colspan=1>jinlingnoodlebar</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>11 Peas Hill City Cen-tre</td><td rowspan=1 colspan=1>C.B 2, 3 P.P</td><td rowspan=1 colspan=1>01223 566188</td></tr><tr><td rowspan=1 colspan=1>kohinoor</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>74 Mill Road City Cen-tre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 323639</td></tr><tr><td rowspan=1 colspan=1>kymmoy</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>oriental</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1> 52 Mill Road City Cen-tre</td><td rowspan=1 colspan=1>C.B 1,2 A.S</td><td rowspan=1 colspan=1>01223 311911</td></tr><tr><td rowspan=1 colspan=1>la margherita</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>italian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1>15MagdaleneStreetCity Centre</td><td rowspan=1 colspan=1>C.B 3,0 A.F</td><td rowspan=1 colspan=1>01223 315232</td></tr><tr><td rowspan=1 colspan=1>la mimosa</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>mediterranean</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>ThompsonsLane FenDitton</td><td rowspan=1 colspan=1>C.B 5,8 A.Q</td><td rowspan=1 colspan=1>01223 362525</td></tr><tr><td rowspan=1 colspan=1>la raza</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>spanish</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>4-6Rose Crescent</td><td rowspan=1 colspan=1>C.B 2, 3L.L</td><td rowspan=1 colspan=1>01223 464550</td></tr><tr><td rowspan=1 colspan=1>la tasca</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>spanish</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>14 -16 Bridge Street</td><td rowspan=1 colspan=1>C.B 2,1U.F</td><td rowspan=1 colspan=1>01223464630</td></tr><tr><td rowspan=1 colspan=1>lan hong house</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>12 Norfolk Street CityCentre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 350420</td></tr></table>
(b) Attention heat map: la margherita is a nice restaurant in the west of town in the cheap price range Table 8: Dialogue visualization 2
<table><tr><td rowspan=1 colspan=1>NAME</td><td rowspan=1 colspan=1>PRICE RANGE</td><td rowspan=1 colspan=1>FOOD</td><td rowspan=1 colspan=1>AREA</td><td rowspan=1 colspan=1>ADDRESS</td><td rowspan=1 colspan=1>POST CODE</td><td rowspan=1 colspan=1>PHONE</td></tr><tr><td rowspan=1 colspan=1>india house</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1>311Newnham RoadNewnham</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 461661</td></tr><tr><td rowspan=1 colspan=1>jrestaurant</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>oriental</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>86RegentStreet CityCentre</td><td rowspan=1 colspan=1>C.B 2, 1 D.P</td><td rowspan=1 colspan=1>01223 307581</td></tr><tr><td rowspan=1 colspan=1> jinlingnoodlebar</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>11 Peas Hill City Cen-tre</td><td rowspan=1 colspan=1>C.B 2, 3 P.P</td><td rowspan=1 colspan=1>01223 566188</td></tr><tr><td rowspan=1 colspan=1>kohinoor</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>indian</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>74 Mill Road City Cen-tre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 323639</td></tr><tr><td rowspan=1 colspan=1>kymmoy</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>oriental</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1> 52 Mill Road City Cen-tre</td><td rowspan=1 colspan=1>C.B 1,2 A.S</td><td rowspan=1 colspan=1>01223 311911</td></tr><tr><td rowspan=1 colspan=1>la margherita</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>italian</td><td rowspan=1 colspan=1>west</td><td rowspan=1 colspan=1> 15 MagdaleneStreetCity Centre</td><td rowspan=1 colspan=1>C.B 3,0 A.F</td><td rowspan=1 colspan=1>01223 315232</td></tr><tr><td rowspan=1 colspan=1>la mimosa</td><td rowspan=1 colspan=1>expensive</td><td rowspan=1 colspan=1>mediterranean</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>ThompsonsLane FenDitton</td><td rowspan=1 colspan=1>C.B 5, 8 A.Q</td><td rowspan=1 colspan=1>01223 362525</td></tr><tr><td rowspan=1 colspan=1>la raza</td><td rowspan=1 colspan=1>cheap</td><td rowspan=1 colspan=1>spanish</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>4 -6 Rose Crescent</td><td rowspan=1 colspan=1>C.B 2, 3 L.L</td><td rowspan=1 colspan=1>01223 464550</td></tr><tr><td rowspan=1 colspan=1>la tasca</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>spanish</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>14-16 Bridge Street</td><td rowspan=1 colspan=1>C.B 2, 1 U.F</td><td rowspan=1 colspan=1>01223 464630</td></tr><tr><td rowspan=1 colspan=1>lan hong house</td><td rowspan=1 colspan=1>moderate</td><td rowspan=1 colspan=1>chinese</td><td rowspan=1 colspan=1>centre</td><td rowspan=1 colspan=1>12 Norfolk Street CityCentre</td><td rowspan=1 colspan=1>EMPTY</td><td rowspan=1 colspan=1>01223 350420</td></tr></table>
(c) Attention heap map: Sure , la margherita is on 15 Magdalene Street City Centre.
 Figure 6: Recipe heat map example 1. The ingredient tokens appear on the left while the recipe tokens appear on the top. The first row is the $p \big ( \bar { z } _ { v } | s _ { v } \big )$ .
 Figure 7: Recipe heat map example 2.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509# Distributional Generalization: Characterizing Classifiers Beyond Test Error
Anonymous Author(s) Affiliation Address email
# Abstract
1 We present a new set of empirical properties of interpolating classifiers, includ 2 ing neural networks, kernel machines and decision trees. Informally, the output 3 distribution of an interpolating classifier matches the distribution of true labels, 4 when conditioned on certain subgroups of the input space. For example, if we 5 mislabel $30 \%$ of dogs as cats in the train set of CIFAR-10, then a ResNet trained 6 to interpolation will in fact mislabel roughly $30 \%$ of dogs as cats on the test set 7 as well, while leaving other classes unaffected. These behaviors are not captured 8 by classical generalization, which would only consider the average error over 9 the inputs, and not where these errors occur. We introduce and experimentally 10 validate a formal conjecture that specifies the subgroups for which we expect this 11 distributional closeness. Further, we show that these properties can be seen as a 12 new form of generalization, which advances our understanding of the implicit bias 13 of interpolating methods.
# 14 1 Introduction
15 In learning theory, when we study how well a classifier “generalizes”, we usually consider a single 16 metric – its test error $\mathbb { \left. \boldsymbol { \mathsf { E 9 } } \right. }$ . However, there could be many different classifiers with the same test error 17 that differ substantially in, say, the subgroups of inputs on which they make errors or in the features 18 they use to attain this performance. Reducing classifiers to a single number misses these rich aspects 19 of their behavior. In this work, we propose formally studying the entire joint distribution of classifier 20 inputs and outputs. That is, the distribution $( x , f ( { \overset { \cdot } { x } } ) )$ for samples from the distribution $x \sim D$ for a 21 classifier $f ( x )$ . This distribution reveals many structural properties of the classifier beyond test error 22 (such as where the errors occur). In fact, we discover new behaviors of modern classifiers that can 23 only be understood in this framework. As an example, consider the following experiment (Figure 1). 24 Experiment 1. Consider a binary classification version of CIFAR-10, where CIFAR-10 images $x$ 25 have binary labels Animal/Object. Take 50K samples from this distribution as a train set, but 26 apply the following label noise: flip the label of cats to Object with probability $30 \%$ . Now train 27 a WideResNet $f$ to 0 train error on this train set. How does the trained classifier behave on test 28 samples? Options below:
29 (1) The test error is low across all classes, since there is only $3 \%$ overall label noise in the train set.
30 (2) Test error is “spread” across the animal class. After all, the classifier is not explicitly told what a 31 cat or a dog is, just that they are all animals. 32 (3) The classifier misclassifies roughly $30 \%$ of test cats as “objects”, but all other animals are largely 33 unaffected. 34 The reality is closest to option (3) as shown in Figure $\mathbb { \underline { { \Pi } } }$ The left panel shows the joint density of 35 train inputs $x$ with train labels Object/Animal. Since the classifier is interpolating, the classifier 36 outputs on the train set are identical to the left panel. The right panel shows the classifier predictions 37 $f ( \bar { x } )$ on test inputs $x$ . 38 There are several notable things about this experiment. First, the error is localized to cats in the test 39 set as it was in the train set, even though no explicit cat labels were provided. The interpolating 40 model is thus sensitive to subgroup-structures in the distribution. Second, the amount of error on 41 the cat class is close to the noise applied on the train set. Thus, the behavior of the classifier on the 42 train set generalizes to the test set in a stronger sense than just average error. Specifically, when 43 conditioned on a subgroup (cat), the distribution of the true labels is close to that of the classifier 44 outputs. Third, this is not the behavior of the Bayes-optimal classifier, which would always output 45 the maximum-likelihood label instead of reproducing the noise in the distribution. The network 46 is thus behaving poorly from the perspective of Bayes-optimality, but behaving well in a certain 47 distributional sense (which we will formalize soon). 48 Now, consider a seemingly unrelated experimental observation. Take an AlexNet trained on ImageNet, 49 a 1000-way classification problem with 116 varieties of dogs. AlexNet only achieves $56 . 5 \%$ test 50 accuracy on ImageNet. However, it at least classifies most dogs as some variety of dog (with $9 8 . 4 \%$ 51 accuracy), though it may mistake the exact breed. In this work, we show that both of these experiments 52 are examples of the same underlying phenomenon. We empirically show that for an interpolating 53 classifier, its classification outputs are close in distribution to the true labels — even when conditioned 54 on many subsets of the domain. For example, in Figure 1, the distribution of $p ( f ( x ) | x = \mathrm { c a t } )$ is close 55 to the true label distribution of $p ( y | x = \mathrm { c a t } )$ . We propose a formal conjecture (Feature Calibration), 56 that predicts which subgroups of the domain can be conditioned on for the above distributional 57 closeness to hold. 58 These experimental behaviors could not have been captured solely by looking at average test error, 59 as is done in the classical theory of generalization. In fact, they are special cases of a new kind of 60 generalization, which we call “Distributional Generalization”.
 Figure 1: The setup and result of Experiment 1. The CIFAR-10 train set is labeled as either Animals or Objects, with label noise affecting only cats. A WideResNet-28-10 is then trained to 0 train error on this train set, and evaluated on the test set. Full experimental details in Appendix C.2
# 61 1.1 Distributional Generalization
62 Informally, Distributional Generalization states that the outputs of classifiers $f$ on their train sets 63 and test sets are close as distributions (as opposed to close in just error). That is, the following joint distributions1 64 are close:
$$( x , f ( x ) ) _ { x \sim \mathrm { T e s t S e t } } \approx ( x , f ( x ) ) _ { x \sim \mathrm { T r a i n S e t } }$$
65 The remainder of this paper is devoted to making the above statement precise, and empirically 66 checking its validity on real-world tasks. Specifically, we want to formally define the notion of 67 approximation $( \approx )$ , and understand how it depends on the problem parameters (the type of classifier, 68 number of train samples, etc). We focus primarily on interpolating methods, where we formalize 69 Equation $( 1 )$ through our Feature Calibration Conjecture.
# 70 1.2 Our Contributions and Organization
71 In this work, we discover new empirical properties of interpolating classifiers, which are not captured 72 in the classical framework of generalization. We then propose formal conjectures to characterize 73 these behaviors.
• In Section $\textcircled { 3 }$ we introduce a formal “Feature Calibration” conjecture, which unifies our experimental observations. Roughly, Feature Calibration says that the outputs of classifiers match the statistics of their training distribution when conditioned on certain subgroups. • In Section $\textcircled { 4 }$ we experimentally stress test our Feature Calibration conjecture across various settings in machine learning, including neural networks, kernel machines, and decision trees. This highlights the universality of our results across machine learning. • In Section $5 ,$ we relate our results to classical generalization, by defining a new notion of Distributional Generalization which subsumes both classical generalization and our new conjectures. • Finally, in Section $5 . 2$ we informally discuss how Distributional Generalization can be applied even for non-interpolating methods.
Our results, thus, extend our understanding of the implicit bias of interpolating methods, and introduce a new type of generalization exhibited across many methods in machine learning.
# 1.3 Related Work and Significance
Our work has connections to, and implications for many existing research programs in deep learning.
Implicit Bias and Overparameterization. There has been a long line of recent work towards understanding overparameterized and interpolating methods, since these pose challenges for classical theories of generalization (e.g. Belkin et al. [8, 9, 10], Breiman [11], Gunasekar et al. $\mathbb { \left[ \left. 2 5 \right] \right. }$ , Liang and Rakhlin $\boxed { \ B 6 }$ , Nakkiran et al. $\mathbb { \lVert \boldsymbol { 4 3 } \rVert }$ , Schapire et al. [58], Soudry et al. [62], Zhang et al. $\pmb { \mathbb { Z } 1 } \mathbf { l }$ ). The “implicit bias” program here aims to answer: Among all models with 0 train error, which model is actually produced by SGD? Most existing work seeks to characterize the exact implicit bias of models under certain (sometimes strong) assumptions on the model, training method or the data distribution. In contrast, our conjecture applies across many different interpolating models (from neural nets to decision trees) as they would be used in practice, and thus form a sort of “universal implicit bias” of these methods. Moreover, our results place constraints on potential future theories of implicit bias, and guide us towards theories that better capture practice.
100 Benign Overfitting. Most prior works on interpolating classifiers attempt to explain why training 101 to interpolation “does not harm” the the model. This has been dubbed “benign overfitting” [7] and 102 “harmless interpolation” [40], reflecting the widely-held belief that interpolation does not harm the 103 decision boundary of classifiers. In contrast, we find that interpolation actually does “harm” classifiers, 104 in predictable ways: fitting the label noise on the train set causes similar noise to be reproduced at 105 test time. Our results thus indicate that interpolation can significantly affect the decision boundary of 106 classifiers, and should not be considered a purely “benign” effect. 107 Classical Generalization and Scaling Limits. Our framework of Distributional Generalization is 108 insightful even to study classical generalization, since it reveals much more about models than just 109 their test error. For example, statistical learning theory attempts to understand if and when models 110 will asymptotically converge to Bayes optimal classifiers, in the limit of large data (“asymptotic 111 consistency” [59, $\dot { 6 5 } \|$ ). In deep learning, there are at least two distinct ways to scale model and data 112 to infinity together: the underparameterized scaling limit, where data-size $\gg$ model-size always, and 113 the overparameterized scaling limit, where data-size $\ll$ model-size always. The underparameterized 114 scaling limit is well-understood: when data is essentially infinite, neural networks will converge to 115 the Bayes-optimal classifier (provided the model-size is large enough, and the optimization is run 116 for long enough, with enough noise to escape local minima). On the other hand, our work suggests 117 that in the overparameterized scaling limit, models will not converge to the Bayes-optimal classifier. 118 Specifically, our Feature Calibration Conjecture implies that in the limit of large data, interpolating 119 models will approach a sampler from the distribution. That is, the limiting model $f$ will be such that 120 the output $f ( x )$ is a sample from $p ( y | x )$ , as opposed to the Bayes-optimal $f ^ { * } ( x ) = \mathop { \mathrm { a r g m a x } } _ { y } p ( y | x )$ . 121 This claim— that overparameterized models do not converge to Bayes-optimal classifiers— is unique 122 to our work as far as we know, and highlights the broad implications of our results. 123 Locality and Manifold Learning. Our intuition for the behaviors in this work is that they arise due to 124 some form of “locality” of the trained classifiers, in an appropriate embedding space. For example, the 125 behavior observed in Experiment $\perp$ would be consistent with that of a 1-Nearest-Neighbor classifier 126 in a embedding that separates the CIFAR-10 classes well. This intuition that classifiers learn good 127 embeddings is present in various forms in the literature, for example: the so-called called “manifold 128 hypothesis,” that natural data lie on a low-dimensional manifold [44, 61], as well as works on local 129 stiffness of the loss landscape $\mathbb { \lVert 1 9 \rVert }$ , and works showing that overparameterized neural networks can 130 learn hidden low-dimensional structure in high-dimensional settings [6, 15, 21]. It is open to more 131 formally understand connections between our work and the above. 132 Other Related Works. Our conjectures also describe neural networks under label noise, which has 133 been empirically and theoretically studied in the past [9, 14, 45, 54, 63, 71, 72], though not formally 134 characterized. A full discussion of related works is in Appendix A.
# 135 2 Preliminaries
136 Notation. We consider joint distributions $\mathcal { D }$ on $x \in \mathcal { X }$ and discrete $y \in \mathcal { y } = [ k ]$ . Let $S =$ 137 $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n } \sim { \mathcal { D } } ^ { n }$ denote a train set of $n$ iid samples from $\mathcal { D }$ . Let $\mathcal { A }$ denote the training procedure 138 (including architecture and training algorithm for neural networks), and let $f \gets \mathrm { T r a i n } _ { \mathcal { A } } ( S )$ denote 139 training a classifier $f$ on train-set $S$ using procedure $\mathcal { A }$ . We consider classifiers which output hard 140 decisions $f : \mathcal { X } \mathcal { Y }$ . Let $\mathrm { N N } _ { S } ( x ) = x _ { i }$ denote the nearest-neighbor to $x$ in train-set $S$ , with 141 respect to a distance metric $d$ . Our theorems will apply to any distance metric, and so we leave 142 this unspecified. Let $\mathrm { N N } _ { S } ^ { ( y ) } ( x )$ denote the nearest-neighbor estimator itself, that is, $\mathrm { N N } _ { S } ^ { ( y ) } ( x ) : = y _ { i }$ 143 where $x _ { i } = \mathrm { N N } _ { S } ( x )$ . 144 Experimental Setup. Briefly, we train all classifiers to interpolation (to 0 train error). Neural 145 networks (MLPs and ResNets $\mathbb { \oplus } \mathbb { I } ,$ ) are trained with SGD. Interpolating decision trees are trained 146 using the growth rule from Random Forests $\mathbb { \lVert 1 2 \rVert }$ . For kernel classification, we consider kernel 147 regression on one-hot labels and kernel SVM, with small or 0 of regularization (which is often 148 optimal $\pmb { \mathbb { H } }$ ). Full experimental details are provided in Appendix B. 149 Distributional Closeness. We consider the following notion of closeness for two probability dis 150 tributions: For two distributions $P , Q$ over $\mathcal { X } \times \mathcal { V }$ , let a “test” (or “distinguisher”) be a function 151 $T : \mathcal { X } \times \mathcal { Y } [ 0 , 1 ]$ which accepts a sample from either distribution, and is intended to classify the 152 sample as either from distribution $P$ or $Q$ . For any set ${ \mathcal { C } } \subseteq \{ T : \mathcal { X } \times \mathcal { Y } \to [ 0 , 1 ] \}$ of tests, we say 153 distributions $P$ and $Q$ are “ $\varepsilon$ -indistinguishable up to $\mathcal { C }$ -tests” if they are close with respect to all tests 154 in class $\mathcal { C }$ . That is,
$$P \approx _ { \varepsilon } ^ { \mathcal { C } } Q \longleftrightarrow \operatorname* { s u p } _ { T \in { \mathcal { C } } } \Big | \underset { ( x , y ) \sim P } { \mathbb { E } } [ T ( x , y ) ] - \underset { ( x , y ) \sim Q } { \mathbb { E } } [ T ( x , y ) ] \Big | \leq \varepsilon$$
155 Total-Variation distance is equivalent to closeness in all tests, i.e. $\mathcal { C } = \{ T : \mathcal { X } \times \mathcal { Y } [ 0 , 1 ] \}$ , but we 156 consider closeness for restricted families of tests $\mathcal { C }$ . $P \approx _ { \varepsilon } Q$ denotes $\varepsilon$ -closeness in TV-distance.
# 3 Feature Calibration Conjecture
# 3.1 Distributions of Interest
59 We first define three key distributions that we will use in stating our formal conjecture. For a given 60 data distribution $\mathcal { D }$ over $\mathcal { X } \times \mathcal { V }$ and training procedure $\operatorname { T r a i n } _ { A }$ , we consider the following three 61 distributions over $\mathcal { X } \times \mathcal { V }$ : 1. Source D: $( x , y )$ where $x , y \sim \mathcal { D }$ . 2. Train ${ \mathcal { D } } _ { \mathrm { t r } }$ : $( x _ { \mathrm { t r } } , f ( x _ { \mathrm { t r } } ) )$ where $S \sim \mathcal { D } ^ { n }$ $, f \mathrm { T r a i n } _ { \cal A } ( S ) , ( x _ { \mathrm { t r } } , y _ { \mathrm { t r } } ) \sim S$ 3. Test $\underline { { \mathcal { D } _ { \mathrm { t e } } \mathbf { : } } } \left( x , f ( x ) \right)$ where $S \sim \mathcal { D } ^ { n } , f \operatorname { T r a i n } _ { A } ( S ) , x , y \sim \mathcal { D }$ 165 The source distribution $\mathcal { D }$ is simply the original distribution. To sample once from the Train Dis 166 tribution ${ \mathcal { D } } _ { \mathrm { t r } }$ , we first sample a train set $S \sim \mathcal { D } ^ { n }$ , train a classifier $f$ on it, then output $( x _ { \mathrm { t r } } , f ( x _ { \mathrm { t r } } ) )$ 167 for a random train point $x _ { \mathrm { t r } } \in S$ . That is, ${ \mathcal { D } } _ { \mathrm { t r } }$ is the distribution of input and outputs of a trained 168 classifier $f$ on its train set. To sample once from the Test Distribution $\mathcal { D } _ { \mathrm { t e } }$ , we do this same proce 169 dure, but output $( x , f ( x ) )$ for a random test point $x$ . That is, the $\mathcal { D } _ { \mathrm { t e } }$ is the distribution of input and 170 outputs of a trained classifier $f$ at test time. The only difference between the Train Distribution and 171 Test Distribution is that the point $x$ is sampled from the train set or the test set, respectively.2 For 172 interpolating classifiers, $f ( x _ { \mathrm { t r } } ) = y _ { \mathrm { t r } }$ on the train set, and so the Source and Train distributions are 173 equivalent: $\mathcal { D } \equiv \mathcal { D } _ { \mathrm { t r } }$ . (Note that these definitions, crucially, involve randomness from sampling the 174 train set, training the classifier, and sampling a test point).
# 175 3.2 Feature Calibration
We now formally describe the Feature Calibration Conjecture. At a high level, we argue that the distributions $\mathcal { D } _ { \mathrm { t e } }$ and $\mathcal { D }$ are statistically close for interpolating classifiers if we first “coarsen” the domain of $x$ by some partition $L : \mathcal { X } [ M ]$ in to $M$ parts. That is, for certain partitions $L$ , the following distributions are statistically close:
$$( L ( x ) , f ( x ) ) _ { x \sim \mathcal { D } } \approx _ { \varepsilon } ( L ( x ) , y ) _ { x \sim \mathcal { D } }$$
176 We think of $L$ as defining subgroups over the domain— for example, $L ( x ) \in \{ \deg , \mathrm { c a t } , \mathrm { h o r s e . } . . \}$ . 177 Then, the above statistical closeness is essentially equivalent to requiring that for all subgroups 178 $\ell \in [ M ]$ , the conditional distribution of classifier output on the subgroup— $p ( f ( x ) | L ( x ) = \bar { \ell } )$ — is 179 close to the true conditional distribution: $p ( y | L ( x ) = \bar { \ell } )$ ). 180 The crux of our conjecture lies in defining exactly which subgroups $L$ satisfy this distributional 181 closeness, and quantifying the $\varepsilon$ approximation. This is subtle, since it must depend on almost all 182 parameters of the problem. For example, consider a modification to Experiment 1, where we use 183 a fully-connected network (MLP) instead of a ResNet. An MLP cannot properly distinguish cats 184 even when it is actually provided the real CIFAR-10 labels, and so (informally) it has no hope of 185 behaving differently on cats in the setting of Experiment 1, where the cats are not labeled explicitly 186 (See Figure ${ \bf C } . 2$ for results with MLPs). Similarly, if we train the ResNet with very few samples from 187 the distribution, the network will be unable to recognize cats. Thus, the allowable partitions must 188 depend on the classifier family and the training method, including the number of samples. 189 We conjecture that allowable partitions are those which can themselves be learnt to good test 190 performance with an identical training procedure, but trained with the labels of the partition $L$ instead 191 of $y$ . To formalize this, we define a distinguishable feature: a partition of the domain $\mathcal { X }$ that is 192 learnable for a given training procedure. Thus, in Experiment $^ { 1 , }$ the partition into CIFAR-10 classes 193 would be a distinguishable feature for ResNets (trained with SGD with 50K or more samples), but 194 not for MLPs. The definition below depends on the training procedure $\mathcal { A }$ , the data distribution $\mathcal { D }$ 195 number of train samples $n$ , and an approximation parameter $\varepsilon$ (which we think of as $\varepsilon \approx 0$ ).
Definition 1 $( ( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ -Distinguishable Feature). For a distribution $\mathcal { D }$ over $\mathcal { X } \times \mathcal { V }$ , number of samples $n$ , training procedure $\mathcal { A }$ , and small $\varepsilon \geq 0$ , an $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ -distinguishable feature is $a$ partition $L : \mathcal { X } [ M ]$ of the domain $\mathcal { X }$ into $M$ parts, such that training a model using $\mathcal { A }$ on $n$ samples labeled by $L$ works to classify $L$ with high test accuracy. Precisely, $L$ is a $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ - distinguishable feature $i f$ :
$$\begin{array} { c c } { { } } & { { \mathrm { ~ P r ~ } } } & { { [ f ( x ) = L ( x ) ] \geq 1 - \varepsilon } } \\ { { } } & { { } } & { { \nonumber } } \\ { { } } & { { \nonumber } } & { { f \mathrm { T r a i n } _ { \cal A } ( S ) ; x { \sim } \mathcal { D } } } \end{array}$$
196 This definition depends only on the marginal distribution of $\mathcal { D }$ on $x$ , and not on the label distribution 197 $p _ { \mathcal { D } } ( y | x )$ . To recap, this definition is meant to capture a labeling of the domain $\mathcal { X }$ that is learnable for 198 a given training procedure $\mathcal { A }$ . It must depend on the architecture used by $\mathcal { A }$ and number of samples 199 $n$ , since more powerful classifiers can distinguish more features. Note that there could be many 200 distinguishable features for a given setting $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ — including features not implied by the class 201 label such as the presence of grass in a CIFAR-10 image. Our main conjecture follows. 202 Conjecture 1 (Feature Calibration). For all natural distributions $\mathcal { D }$ , number of samples $n$ , interpo 203 lating training procedures $A$ , and $\varepsilon \geq 0$ , the following distributions are statistically close for all 204 $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ -distinguishable features $L$ :
$$\begin{array} { r l r l } { ( L ( x ) , f ( x ) ) } & { { } \approx _ { \varepsilon } } & { } & { { } ( L ( x ) , y ) } \\ { f \gets \mathrm { T r a i n } _ { \cal A } ( \mathscr { D } ^ { n } ) ; x , y { \sim } \mathscr { D } } & { } & { { } x , y { \sim } \mathscr { D } } \end{array}$$
$$\begin{array} { r l r } { ( L ( x ) , \widehat { y } ) } & { { } \approx _ { \varepsilon } } & { ( L ( x ) , y ) } \\ { _ { - } x , \widehat { y } { \sim } \mathcal { D } _ { \mathrm { t e } } } & { { } } & { x , y { \sim } \mathcal { D } } \end{array}$$
206 This claims that the TV distance between the LHS and RHS of Equation $\textcircled{4}$ is at most $\varepsilon$ , where $\varepsilon$ is the 207 error of the distinguishable feature (in Definition $\mathbb { D }$ . We claim that this holds for all distinguishable 208 features $L$ “automatically” – we simply train a classifier, without specifying any particular partition. 209 The formal statements of Definition $\dot { 1 }$ and Conjecture $^ 1$ may seem somewhat arbitrary, involving 210 many quantifiers over $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ . However, we believe these statements are natural: In addition 211 to extensive experimental evidence in Section $^ { 4 , }$ we also prove that Conjecture $^ 1$ is formally true as 212 stated for 1-Nearest-Neighbor classifiers in Theorem 1.
# 213 3.3 Feature Calibration for 1-Nearest-Neighbors
214 Here we prove that the 1-Nearest-Neighbor classifier formally satisfies Conjecture $^ { 1 , }$ under mild 215 assumptions. We view this theorem as support for our (somewhat involved) formalism of Conjecture 1. 216 Indeed, without Theorem 1 below, it is unclear if our statement of Conjecture 1 can ever be satisfied by 217 any classifier, or if it is simply too strong to be true. This theorem applies generically to a wide class 218 of distributions; the only assumption is a weak regularity condition: sampling the nearest-neighbor 219 train point to a random test point should yield (close to) a uniformly random test point. 220 Theorem 1. Let $\mathcal { D }$ be a distribution over $\mathcal { X } \times \mathcal { V } _ { : }$ , and let $n \in \mathbb N$ be the number of train samples. 221 Assume the following regularity condition holds: Sampling the nearest-neighbor train point to a 222 random test point yields (close to) a uniformly random test point. That is, suppose that for some 223 small $\delta \geq 0$ , the distributions: $\begin{array} { r l r } { \{ \mathrm { N N } _ { S } ( x ) \} _ { S \sim \mathcal { D } ^ { n } } } & { { } \approx _ { \delta } } & { \{ x \} _ { x \sim \mathcal { D } } } \end{array}$ . Then, Conjecture 1 holds. That is, 224 for all $( \varepsilon , \mathrm { N N } , \mathcal { D } , n )$ -distinguishable partitions $L$ , the following distributions are statistically close:
$$\begin{array} { r l } { \{ ( y , L ( x ) ) \} _ { x , y \sim \mathcal { D } } } & { { } \approx _ { \varepsilon + \delta } \quad \{ ( \mathrm { N N } _ { S } ^ { ( y ) } ( x ) , L ( x ) \} _ { S \sim \mathcal { D } ^ { n } } } \end{array}$$
The proof of Theorem $\bigstar$ is straightforward, and provided in Appendix $\overline { { \mathbb { D } } } -$ but this strong property of nearest-neighbors was not know before, to our knowledge.
# 3.4 Limitations: Natural Distributions
Technically, Conjecture $\bigtriangledown$ is not fully specified, since it does not specify exactly which classifiers or distributions obey the conjecture. We do not claim that all classifiers and distributions satisfy our conjectures. Nevertheless, we claim our conjectures hold in all “natural” settings, which informally means settings with real data and classifiers that are actually used in practice. The problem of understanding what separates “natural distributions” from artificial ones is not unique to our work, and lies at the heart of deep learning theory. Many theoretical works handle this by considering simplified distributional assumptions (e.g. smoothness, well-separatedness, gaussianity), which are mathematically tractable, but untested in practice [2, 4, 35]. In contrast, we do not make untestable mathematical assumptions. This benefit of realism comes at the cost of mathematical formalism. We hope that as the theory of deep learning evolves, we will better understand how to formalize the notion of “natural” in our conjectures.
# 239 4 Experiments: Feature Calibration
240 We now give empirical evidence for our conjecture in a variety of settings in machine learning, 241 including neural networks, kernel machines, and decision trees. In each experiment, we consider 242 a feature that is (verifiably) distinguishable, and then test our Feature Calibration conjecture for 243 this feature. Each of the experimental settings below highlights a different aspect of interpolating 244 classifiers, which may be of independent interest. Selected experiments are summarized here, with 245 full details and further experiments in Appendix C.
Constant Partition: Consider the trivially-distinguishable constant feature: $L ( x ) = 0$ everywhere. For this feature, Conjecture $^ 1$ reduces to the statement that the marginal distribution of class labels for any interpolating classifier is close to the true marginals $p ( y )$ . To test this, we construct a variant of CIFAR-10 with class-imbalance and train classifiers with varying levels of test errors to interpolation on it. As shown in Figure $2 \mathrm { B }$ , the marginals of the classifier outputs are close to the true marginals, even for a classifier that only achieves $37 \%$ test error.
252 Coarse Partition: Consider AlexNet trained on ILSVRC-2012 ImageNet $\begin{array} { r l } { { \bigl [ \bigl | \boldsymbol { 5 } 6 \bigr | \bigr ] } } \end{array}$ , a 1000-class image 253 classification problem with 116 varieties of dogs. The network achieves only $56 . 5 \%$ accuracy 254 on the test set. But it will at least classify most dogs as dogs (with $9 8 . 4 \%$ accuracy), making 255 $L ( x ) \in \{ \log , \mathrm { n o t } \mathrm { - d o g } \}$ a distinguishable feature. Moreover, as predicted by Conjecture 1, the 256 network is calibrated with respect to dogs: $2 2 . 4 \%$ of all dogs in ImageNet are Terriers, and indeed 257 the network classifies $2 0 . 9 \%$ of all dogs as Terriers (though it has $9 \%$ error on which specific dogs 258 it classifies as Terriers). See Appendix Table $2$ for details, and related experiments on ResNets and 259 kernels in Appendix C. 260 Class Partition: We now consider settings where the class labels are themselves distinguishable 261 features (eg: CIFAR-10 classes are distinguishable by ResNets). Here our conjecture predicts the 262 behavior of interpolating classifiers under structured label noise. As an example, we generate a 263 random spare confusion matrix and apply this to the labels of CIFAR-10 as shown in Figure $2 \mathrm { A }$ . 264 We find that a WideResNet trained to interpolation outputs the same confusion matrix on the test 265 set as well (Figure $\bigstar \bigstar \bigstar$ ). Now, to test that this phenomenon is indeed robust to the level of noise, we 266 mislabel class $0 \overline { { 1 } }$ with probability $p$ in the CIFAR-10 train set for varying levels of $p$ . We then 267 observe $\widehat { p } .$ , the fraction of samples mislabeled by this network from $0 1$ in the test set (Figure $3 \mathsf { A }$ 268 shows $p$ versus $\widehat { p } \big )$ ). The Bayes optimal classifier for this distribution behaves as a step function (in 269 bred), and a classifier that obeys Conjecture 1 exactly would follow the diagonal (in green). The actual 270 experiment (in blue) is close to the behavior predicted by Conjecture 1. This experiment shows a 271 contrast with classical learning theory. While most existing theory focuses on whether classifiers 272 converge to the Bayes optimal solution, we show that interpolating classifiers behave “optimally” in a 273 different sense: they match the distribution of their train set. We discuss this further in Section 5. See 274 Appendix C.4 for more experiments, including other classifiers such as Decisions Trees. 275 Multiple features: Conjecture 1 states that the network should be automatically calibrated for 276 all distinguishable features, without any explicit labels for them. To do this, we use the CelebA 277 dataset $\ [ \overbrace { 3 7 } ]$ , containing images with many binary attributes per image. (“male”, “blond hair”, etc). 78 We train a ResNet-50 to classify one of the hard attributes (accuracy $80 \%$ ) and confirm that the 279 Feature Calibration holds for all the other attributes (Figure $3 )$ that are themselves distinguishable. 280 Quantitative predictions: We now test the quantitative predictions made by Conjecture $\boxed { 1 }$ This 281 conjecture states that the TV-distance between the joint distributions $( L ( x ) , f ( x ) )$ and $( \overline { { \cal L } } ( x ) , y )$ 282 is at most $\varepsilon$ , where $\varepsilon$ is the error of the training procedure in learning $L$ (see Definition $\blacktriangleleft$ . To 283 test this, we consider binary task similar to Experiment $^ 1$ where (Ship, Plane) are labeled as 284 class 0 and (Cat, Dog) are labeled as class 1, with $p = \overline { { 0 . 3 } }$ fraction of cats mislabeled to class 0. 285 Then, we train a convolutional network to interpolation on this task. To vary the error $\varepsilon$ on these 286 distinguishable features systematically, we train networks with varying number of train samples. 287 Networks with fewer samples have larger $\varepsilon$ since they are worse at classifying the distinguishable 288 features of (Ship,Plane,Cat,Dog). Then, we use the same setup to train networks on the binary 289 task and measure the TV-distance between $( L ( x ) , f ( x ) )$ and $( L ( x ) , y )$ in this task. The results are 290 shown in Figure $\textcircled { 3 } \textcircled { C }$ . As predicted, the TV distance on the binary task is upper bounded by $\varepsilon$ error on 291 the 4-way classification task.
 Figure 2: Feature Calibration. (A) Random confusion matrix on CIFAR-10, with a WideResNet28- 10 trained to interpolation. Left: Joint density of labels $y$ and original class $L$ on the train set. Right: Joint density of classifier predictions $f ( x )$ and original class $L$ on the test set. These two joint densities are close, as predicted by Conjecture 1. $\mathbf { ( B ) }$ Constant partition: The CIFAR-10 train set is class-rebalanced according to the left panel distribution. The center and right panels show that both ResNets and MLPs have the correct marginal distribution of outputs, even though the MLP has high test error.
 Figure 3: Feature Calibration. (A) CIFAR-10 with $p$ fraction of class $0 1$ mislabeled on the train set. Plotting observed noise on classifier outputs vs. applied noise on the train set. $\mathbf { ( B ) }$ Multiple feature calibration on CelebA. (C) TV-distance between $( \bar { L } \bar { ( } x ) , f ( x ) )$ and $( L ( x ) , y )$ for a variant of Experiment $\bigtriangledown$ with error on the distinguishable partitions $( \varepsilon )$ . The error was changed by changing the number of samples $n$ .
# 92 5 Distributional Generalization
In order to relate our results to the classical theory of generalization, we now propose a formal notion of “Distributional Generalization”, which subsumes both Feature Calibration and classical generalization. In fact, we will also give preliminary evidence that this new notion can apply even for non-interpolating methods, unlike Feature Calibration.
7 A trained model $f$ obeys classical generalization (with respect to test error) if its error on the train set 98 is close to its error on the test distribution. We first rewrite this using our definitions below.
Classical Generalization (informal): Let $f$ be a trained classifier. Then $f$ generalizes if:
$$\begin{array} { r } { \underset { x \sim T r a i n S e t } { \mathbb { E } } [ \mathbb { 1 } \{ \widehat { y } \neq y ( x ) \} ] \approx \underset { \stackrel { x \sim T e s t S e t } { \widehat { y } f ( x ) } } { \mathbb { E } } [ \mathbb { 1 } \{ \widehat { y } \neq y ( x ) \} ] } \\ { \quad \widehat { y } f ( x ) } \end{array}$$
300 Above, $y ( x )$ is the true class of $x$ and $\widehat { y }$ is the predicted class. The LHS of Equation $\textcircled{6}$ is the train 301 error of $f$ , and the RHS is the test error. Using our definitions of $\mathcal { D } _ { \mathrm { t r } } , \mathcal { D } _ { \mathrm { t e } }$ from Section $\boxed { 3 . 1 }$ and 302 defining $T _ { \mathrm { e r r } } ( x , \widehat { y } ) : = \mathbb { 1 } \{ \widehat { y } \neq y ( x ) \}$ , we can write Equation $6$ equivalently:
$$\underset { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t r } } } { \mathbb { E } } [ T _ { \mathrm { e r r } } ( x , \widehat { y } ) ] \approx \underset { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t e } } } { \mathbb { E } } [ T _ { \mathrm { e r r } } ( x , \widehat { y } ) ]$$
303 That is, classical generalization states that a certain function $T _ { \mathrm { e r r } } )$ has similar expectations on both the 304 Train Distribution ${ \mathcal { D } } _ { \mathrm { t r } }$ and Test Distribution $\mathcal { D } _ { \mathrm { t e } }$ . We can now introduce Distributional Generalization, 305 which is a property of trained classifiers. It is parameterized by a set of bounded functions (“tests”): 306 ${ \mathcal { T } } \subseteq \{ T : { \dot { \mathcal { X } } } \times { \dot { \mathcal { y } } } \} \to [ 0 , 1 ] \}$ . 307 Distributional Generalization: Let $f$ be a trained classifier. Then $f$ satisfies Distributional Gener 308 alization with respect to tests $\tau$ if:
$$\forall T \in { \mathcal { T } } : \quad \underset { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t r } } } { \mathbb { E } } [ T ( x , \widehat { y } ) ] \approx \underset { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t e } } } { \mathbb { E } } [ T ( x , \widehat { y } ) ]$$
309
310 This states that the train and test distribution have similar expectations for all functions in the family 311 $\tau$ , which we can write as: $\mathcal { D } _ { \mathrm { t r } } \approx ^ { \mathcal { T } } \ \mathcal { D } _ { \mathrm { t e } }$ . For the singleton set $\mathcal { T } = \{ T _ { \mathrm { e r r } } \}$ , this is equivalent to 312 classical generalization, but it may hold for much larger sets $\tau$ . This definition of Distributional 313 Generalization, like the definition of classical generalization, is just defining an object— not stating 314 when or how it is satisfied. Feature Calibration turns this into a concrete conjecture.
# 15 5.1 Feature Calibration as Distributional Generalization
We can write our Feature Calibration Conjecture as a special case of Distributional Generalization, for a certain family of tests $\tau$ . Informally, for a given setting, the family $\tau$ is all tests which take input $( x , y )$ , but only depend on $x$ via a distinguishable feature (Definition $^ { 1 ) }$ . For example, a test of the form $T ( x , y ) \dot { = } g \bar { ( } L ( x ) , y )$ where $L$ is a distinguishable feature, and $g$ is arbitrary. Formally, for a given problem setting, suppose $\mathcal { L }$ is the set of $( \varepsilon , \mathcal { A } , \mathcal { D } , n )$ -distinguishable features. Then Conjecture $\bar { 1 }$ states that $\forall L \in \mathcal { L } : ( L ( x ) , f ( x ) ) \approx _ { \varepsilon } ( L ( x ) , y )$ . This is equivalent to the statement
$$\mathcal { D } _ { \mathrm { t e } } \approx _ { \varepsilon } ^ { T } \mathcal { D }$$
 Figure 4: Distributional Generalization for WideResNet on CIFAR-10. The confusion matrices on the train set (top row) and test set (bottom row) remain close throughout training.
322 where $\tau$ is the set of functions $\mathcal T : = \{ T : T ( x , y ) = g ( L ( x ) , y )$ , $L \in \mathcal { L } , g : \mathcal { X } \times \mathcal { Y } [ 0 , 1 ] \}$ . 323 For interpolating classifiers, we have $\mathcal { D } \equiv \mathcal { D } _ { \mathrm { t r } }$ , and so Equation $\textcircled { 9 }$ is equivalent to $\mathcal { D } _ { \mathrm { t e } } \approx _ { \varepsilon } ^ { \mathcal { T } } \mathcal { D } _ { \mathrm { t r } }$ 324 which is a statement of Distributional Generalization. Since any classifier family will contain a large 325 number of distinguishable features, the set $\mathcal { L }$ may be very large. Hence, the distributions ${ \mathcal { D } } _ { \mathrm { t r } }$ and $\mathcal { D } _ { \mathrm { t e } }$ 326 can be thought of as being close as distributions.
# 5.2 Beyond Interpolating Methods
The previous sections have focused on interpolating classifiers, which fit their train sets exactly. Here we informally discuss how to extend our results beyond interpolating methods. The discussion in this section is not as precise as in previous sections, and is only meant to suggest that our abstraction of Distributional Generalization can be useful in other settings.
For non-interpolating classifiers, we may still expect that they behave similarly on their test and train sets – that is, $\mathcal { D } _ { \mathrm { t e } } \approx ^ { \tau } \mathcal { D } _ { \mathrm { t r } }$ for some family of tests $\tau$ . For example, the following is a possible generalization of Feature Calibration to non-interpolating methods.
335 Conjecture 2 (Generalized Feature Calibration, informal). For trained classifiers $f _ { i }$ , the following 336 distributions are statistically close for many partitions $L$ of the domain:
$$\begin{array} { r l r } { ( L ( x ) , \widehat { y } ) } & { { } \approx } & { ( L ( x ) , \widehat { y } ) } \\ { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t e } } } & { { } } & { x , \widehat { y } \sim \mathcal { D } _ { \mathrm { t r } } } \end{array}$$
337 We leave unspecified the exact set of partitions $L$ for which this holds, since we do not yet understand 338 the appropriate notion of “distinguishable feature” in this setting. However, we give experimental 339 evidence suggesting some refinement of Conjecture $2$ is true. In Figure $^ { 4 , }$ we apply label noise from 340 a random sparse confusion to the CIFAR-10 train set. We then train a single WideResNet28-10, and 341 measure its predictions on the train and test sets over increasing train time (SGD steps). The top row 342 shows the confusion matrix of predictions $f ( x )$ vs true labels $L ( x )$ on the train set, and the bottom 343 row shows the corresponding confusion matrix on the test set. As the network is trained for longer, it 344 fits more of the noise on the train set, and this noise is mirrored almost identically on the test set. Full 345 experimental details, and an analogous experiment for kernels, are given in Appendix B.
# 346 6 Conclusion
347 This work initiates the study of a new kind of generalization— Distributional Generalization— which 348 considers the entire input-output behavior of classifiers, instead of just their test error. We presented 349 both new empirical behaviors, and new formal conjectures which characterize these behaviors. 350 Roughly, our conjecture states that the outputs of classifiers on the test set are “close in distribution” 351 to their outputs on the train set. These results build a deeper understanding of models used in practice, 352 and we hope our results inspire further work on distributional generalization in machine learning.
References [1] Madhu S Advani and Andrew M Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv preprint arXiv:1710.03667, 2017. [2] Zeyuan Allen-Zhu, Yuanzhi Li, and Yingyu Liang. Learning and generalization in overparameterized neural networks, going beyond two layers. arXiv preprint arXiv:1811.04918, 2018. [3] Zeyuan Allen-Zhu, Yuanzhi Li, and Yingyu Liang. Learning and generalization in overparameterized neural networks, going beyond two layers. In Advances in neural information processing systems, pages 6158–6169, 2019. [4] Sanjeev Arora, Simon Du, Wei Hu, Zhiyuan Li, and Ruosong Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In International Conference on Machine Learning, pages 322–332, 2019. [5] Susan Athey, Julie Tibshirani, Stefan Wager, et al. Generalized random forests. The Annals of Statistics, 47(2):1148–1178, 2019. [6] Francis Bach. Breaking the curse of dimensionality with convex neural networks. The Journal of Machine Learning Research, 18(1):629–681, 2017. [7] Peter L Bartlett, Philip M Long, Gábor Lugosi, and Alexander Tsigler. Benign overfitting in linear regression. Proceedings of the National Academy of Sciences, 2020. [8] Mikhail Belkin, Daniel J Hsu, and Partha Mitra. Overfitting or perfect fitting? risk bounds for classification and regression rules that interpolate. In Advances in neural information processing systems, pages 2300–2311, 2018. [9] Mikhail Belkin, Siyuan Ma, and Soumik Mandal. To understand deep learning we need to understand kernel learning. arXiv preprint arXiv:1802.01396, 2018. [10] Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machinelearning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019. [11] Leo Breiman. Reflections after refereeing papers for nips. The Mathematics of Generalization, pages 11–15, 1995. [12] Leo Breiman. Random forests. Machine learning, 45(1):5–32, 2001. [13] Leo Breiman, Jerome Friedman, Charles J Stone, and Richard A Olshen. Classification and regression trees. CRC press, 1984. [14] Niladri S Chatterji and Philip M Long. Finite-sample analysis of interpolating linear classifiers in the overparameterized regime. arXiv preprint arXiv:2004.12019, 2020. [15] Lenaic Chizat and Francis Bach. Implicit bias of gradient descent for wide two-layer neural networks trained with the logistic loss. arXiv preprint arXiv:2002.04486, 2020. [16] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml. [17] Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. [18] Manuel Fernández-Delgado, Eva Cernadas, Senén Barro, and Dinani Amorim. Do we need hundreds of classifiers to solve real world classification problems? The journal of machine learning research, 15(1):3133–3181, 2014. [19] Stanislav Fort, Paweł Krzysztof Nowak, Stanislaw Jastrzebski, and Srini Narayanan. Stiffness: A new perspective on generalization in neural networks. arXiv preprint arXiv:1901.09491, 2019. [20] Mario Geiger, Stefano Spigler, Stéphane d’Ascoli, Levent Sagun, Marco Baity-Jesi, Giulio Biroli, and Matthieu Wyart. Jamming transition as a paradigm to understand the loss landscape of deep neural networks. Physical Review E, 100(1):012115, 2019. [21] Federica Gerace, Bruno Loureiro, Florent Krzakala, Marc Mézard, and Lenka Zdeborová. Generalisation error in learning with random features and the hidden manifold model. arXiv preprint arXiv:2002.09339, 2020. [22] Behrooz Ghorbani, Song Mei, Theodor Misiakiewicz, and Andrea Montanari. Linearized two-layers neural networks in high dimension. arXiv preprint arXiv:1904.12191, 2019. [23] Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American statistical Association, 102(477):359–378, 2007. [24] Sebastian Goldt, Madhu S Advani, Andrew M Saxe, Florent Krzakala, and Lenka Zdeborova. Generalisation dynamics of online learning in over-parameterised neural networks. arXiv preprint arXiv:1901.09085, 2019. [25] Suriya Gunasekar, Jason Lee, Daniel Soudry, and Nathan Srebro. Characterizing implicit bias in terms of optimization geometry. In International Conference on Machine Learning, pages 1832–1841. PMLR, 2018. [26] Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. arXiv preprint arXiv:1706.04599, 2017. [27] Trevor Hastie, Robert Tibshirani, and Jerome Friedman. The elements of statistical learning: data mining, inference, and prediction. Springer Science & Business Media, 2009. [28] Trevor Hastie, Andrea Montanari, Saharon Rosset, and Ryan J Tibshirani. Surprises in highdimensional ridgeless least squares interpolation. arXiv preprint arXiv:1903.08560, 2019. [29] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016. [30] Úrsula Hébert-Johnson, Michael Kim, Omer Reingold, and Guy Rothblum. Multicalibration: Calibration for the (computationally-identifiable) masses. In International Conference on Machine Learning, pages 1939–1948, 2018. [31] Tin Kam Ho. Random decision forests. In Proceedings of 3rd international conference on document analysis and recognition, volume 1, pages 278–282. IEEE, 1995. [32] Rashidedin Jahandideh, Alireza Tavakoli Targhi, and Maryam Tahmasbi. Physical attribute prediction using deep residual neural networks. arXiv preprint arXiv:1812.07857, 2018. [33] Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009. [34] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. [35] Yuanzhi Li, Colin Wei, and Tengyu Ma. Towards explaining the regularization effect of initial large learning rate in training neural networks. arXiv preprint arXiv:1907.04595, 2019. [36] Tengyuan Liang and Alexander Rakhlin. Just interpolate: Kernel" ridgeless" regression can generalize. arXiv preprint arXiv:1808.00387, 2018. [37] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015. [38] Song Mei and Andrea Montanari. The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355, 2019. [39] Nicolai Meinshausen. Quantile regression forests. Journal of Machine Learning Research, 7 (Jun):983–999, 2006. [40] Vidya Muthukumar, Kailas Vodrahalli, Vignesh Subramanian, and Anant Sahai. Harmless interpolation of noisy data in regression. IEEE Journal on Selected Areas in Information Theory, 2020. 47 [41] Elizbar A Nadaraya. On estimating regression. Theory of Probability & Its Applications, 9(1): 141–142, 1964. 49 [42] Vaishnavh Nagarajan and J. Zico Kolter. Uniform convergence may be unable to explain generalization in deep learning, 2019. [43] Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. Deep double descent: Where bigger models and more data hurt. In International Conference on Learning Representations, 2020. 454 [44] Hariharan Narayanan and Sanjoy Mitter. Sample complexity of testing the manifold hypothesis. In Advances in neural information processing systems, pages 1786–1794, 2010. [45] Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In Advances in neural information processing systems, pages 1196–1204, 2013. [46] Brady Neal, Sarthak Mittal, Aristide Baratin, Vinayak Tantia, Matthew Scicluna, Simon LacosteJulien, and Ioannis Mitliagkas. A modern take on the bias-variance tradeoff in neural networks. arXiv preprint arXiv:1810.08591, 2018. [47] Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. Towards understanding the role of over-parametrization in generalization of neural networks. arXiv preprint arXiv:1805.12076, 2018. [48] Alexandru Niculescu-Mizil and Rich Caruana. Predicting good probabilities with supervised learning. In Proceedings of the 22nd international conference on Machine learning, pages 625–632, 2005. [49] Matthew A Olson and Abraham J Wyner. Making sense of random forest probabilities: a kernel perspective. arXiv preprint arXiv:1812.05792, 2018. [50] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017. [51] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. [52] Taylor Pospisil and Ann B Lee. Rfcde: Random forests for conditional density estimation. arXiv preprint arXiv:1804.05753, 2018. [53] Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pages 1177–1184, 2008. [54] David Rolnick, Andreas Veit, Serge Belongie, and Nir Shavit. Deep learning is robust to massive label noise. arXiv preprint arXiv:1705.10694, 2017. [55] Jonas Rothfuss, Fabio Ferreira, Simon Walther, and Maxim Ulrich. Conditional density estimation with neural networks: Best practices and benchmarks. arXiv preprint arXiv:1903.00954, 2019. [56] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. [57] Robert E Schapire. Theoretical views of boosting. In European conference on computational learning theory, pages 1–10. Springer, 1999. [58] Robert E Schapire, Yoav Freund, Peter Bartlett, Wee Sun Lee, et al. Boosting the margin: A new explanation for the effectiveness of voting methods. The annals of statistics, 26(5):1651–1686, 1998. [59] Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. [60] Vaishaal Shankar, Alex Fang, Wenshuo Guo, Sara Fridovich-Keil, Ludwig Schmidt, Jonathan Ragan-Kelley, and Benjamin Recht. Neural kernels without tangents. arXiv preprint arXiv:2003.02237, 2020. [61] Utkarsh Sharma and Jared Kaplan. A neural scaling law from the dimension of the data manifold. arXiv preprint arXiv:2004.10802, 2020. [62] Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 19(1):2822–2878, 2018. [63] Sunil Thulasidasan, Tanmoy Bhattacharya, Jeff Bilmes, Gopinath Chennupati, and Jamal Mohd-Yusof. Combating label noise in deep learning using abstention. arXiv preprint arXiv:1905.10964, 2019. [64] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, CJ Carey, ˙ Ilhan Polat, Yu Feng, Eric W. Moore, Jake Vand erPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1. 0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17:261–272, 2020. doi: https://doi.org/10. 1038/s41592-019-0686-2. [65] Larry Wasserman. All of statistics: a concise course in statistical inference. Springer Science & Business Media, 2013. [66] Geoffrey S Watson. Smooth regression analysis. Sankhya: The Indian Journal of Statistics, ¯ Series A, pages 359–372, 1964. [67] Abraham J Wyner, Matthew Olson, Justin Bleich, and David Mease. Explaining the success of adaboost and random forests as interpolating classifiers. The Journal of Machine Learning Research, 18(1):1558–1590, 2017. [68] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. [69] Mohammad Yaghini, Bogdan Kulynych, and Carmela Troncoso. Disparate vulnerability: On the unfairness of privacy attacks against machine learning. arXiv preprint arXiv:1906.00389, 2019. [70] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. [71] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016. [72] Liu Ziyin, Blair Chen, Ru Wang, Paul Pu Liang, Ruslan Salakhutdinov, Louis-Philippe Morency, and Masahito Ueda. Learning not to learn in the presence of noisy labels. arXiv preprint arXiv:2002.06541, 2020.
1. For all authors...
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] (b) Did you describe the limitations of your work? [Yes] (c) Did you discuss any potential negative societal impacts of your work? [No] This paper does not introduce any new methods or applications, and we thus cannot predict any near-term societal impact (positive or negative). (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
2. If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
3. If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] No new methods were introduced, so the code is standard. We fully specify all experimental hyperparameters for the sake of reproduction. (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] The experiments we consider all exhibit concentration around their expected values, and this is well-known in the community. Notably, we only consider supervised learning. (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No]
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators? [Yes] (b) Did you mention the license of the assets? [No] (c) Did you include any new assets either in the supplemental material or as a URL? [No] (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
5. If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360# LEARNING CURVES FOR ANALYSIS OF DEEP NETWORKS
Anonymous authors Paper under double-blind review
# ABSTRACT
A learning curve models a classifier’s test error as a function of the number of training samples. Prior works show that learning curves can be used to select model parameters and extrapolate performance. We investigate how to use learning curves to analyze the impact of design choices, such as pretraining, architecture, and data augmentation. We propose a method to robustly estimate learning curves, abstract their parameters into error and data-reliance, and evaluate the effectiveness of different parameterizations. We also provide several interesting observations based on learning curves for a variety of image classification models.
# 1 INTRODUCTION
What gets measured gets optimized. We need better measures of learning ability to design better classifiers and predict the payoff of collecting more data. Currently, classifiers are evaluated and compared by measuring performance on one or more datasets according to a fixed train/test split. Ablation studies help evaluate the impact of design decisions. However, one of the most important characteristics of a classifier, how it performs with varying numbers of training samples, is rarely measured or modeled.
In this paper, we refine the idea of learning curves that model error as a function of training set size. Learning curves were introduced nearly thirty years (e.g. by Cortes et al. (1993)) to accelerate model selection of deep networks. Recent works have demonstrated the predictability of performance improvements with more data (Hestness et al., 2017; Johnson & Nguyen, 2017; Kaplan et al., 2020; Rosenfeld et al., 2020) or more network parameters (Kaplan et al., 2020; Rosenfeld et al., 2020). But such studies have typically required large-scale experiments that are outside the computational budgets of many research groups, and their purpose is extrapolation rather than validating design choices. We find that a generalized power law function provides the best learning curve fit, while a model linear in $n ^ { - 0 . 5 }$ , where $n$ is the number of training samples (or “training size”), provides a good local approximation. We abstract the curve into two key parameters: $e _ { N }$ and $\beta _ { N } , e _ { N }$ is error at $n = N$ , and $\beta _ { N }$ is a measure of data-reliance, revealing how much a classifier’s error will change if the training set size changes. Learning curves provide valuable insights that cannot be obtained by single-point comparisons of performance. Our aim is to promote the use of learning curves as part of a standard learning system evaluation.
# Our key contributions:
• Investigate how to best model, estimate, characterize, and display learning curves for use in classifier analysis • Use learning curves to analyze impact on error and data-reliance due to network architecture, depth, width, fine-tuning, data augmentation, and pretraining
Table 1 shows validated and rejected popular beliefs that single-point comparisons often overlook. In the following sections, we investigate how to model learning curves (Sec. 2), how to estimate them (Sec. 3), and what they can tell us about the impact of design decisions (Sec. 4), with discussion of limitations and future work in Sec. 5.
<table><tr><td>Popular beliefs</td><td>Your guess</td><td>Our guess</td><td>Our result</td><td>Result figures</td></tr><tr><td>Pre-training on similar domains nearly always helps compared to training from scratch.</td><td></td><td></td><td></td><td>9a,9b,3</td></tr><tr><td>Pre-training,even on similar domains,introduces bias that would harm performance with alarge enough training set.</td><td></td><td></td><td></td><td>3</td></tr><tr><td>Self-/un-supervised training performs better than supervised pre-training for small datasets.</td><td></td><td></td><td></td><td>3</td></tr><tr><td>Fine-tuning the entire network (vs. just the classification layer)is only helpful if the training set is large.</td><td></td><td></td><td></td><td>9a,9b</td></tr><tr><td>Increasing network depth,when fine-tuning,harms performance forsmalltraining sets,duetoanoverly complex model.</td><td></td><td></td><td></td><td>4a,4b</td></tr><tr><td>Increasing network depth, when fine-tuning,is more helpful for larger training sets than smaller ones.</td><td></td><td></td><td></td><td>4a, 4b</td></tr><tr><td>Increasing network depth,if thebackbone is frozen,is more helpful for smaller trainingsets than larger ones.</td><td></td><td></td><td></td><td>4a, 4b</td></tr><tr><td>Increasing depth or width improves more than ensembles of smaller networks with the same numberof parameters.</td><td></td><td></td><td></td><td>4e,4a</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Data augmentation is roughly equivalent to using a m-times larger training set for some m.</td><td></td><td></td><td></td><td>5</td></tr></table>
Table 1: Deep learning quiz! We encourage our readers to judge each claim as T (true) or F (false), and then compare to our guesses and results. In the results column, “T” means the experiments are consistent with the belief, “F” for inconsistent, and “?” for hard to say.
# 2 MODELING LEARNING CURVES
The learning curve measures test error $e _ { t e s t }$ as a function of the number of training samples $n$ for a given classification model and learning method. Previous empirical observations suggest a functional form $e _ { t e s t } ( n ) = \alpha + \eta n ^ { \gamma }$ , with bias-variance trade-off and generalization theories typically indicating $\gamma = - 0 . 5$ . We summarize what bias-variance trade-off and generalization theories (Sec. 2.1) and empirical studies (Sec. 2.2) can tell us about learning curves, and describe our proposed abstraction in Sec. 2.3.
# 2.1 BIAS-VARIANCE TRADE-OFF AND GENERALIZATION THEORY
The bias-variance trade-off is an intuitive and theoretical way to think about generalization. The “bias” is error due to inability of the classifier to encode the optimal decision function, and the “variance” is error due to variations in predictions due to limited availability of training samples for parameter estimation. This is called a trade-off because a classifier with more parameters tends to have less bias but higher variance. Geman et al. (1992) decompose mean squared regression error into bias and variance and explore the implications for neural networks, leading to the conclusion that “identifying the right preconditions is the substantial problem in neural modeling”. This conclusion foreshadows the importance of pretraining, though Geman et al. thought the preconditions must be built in rather than learned. Domingos (2000) extends the analysis to classification. Theoretically, the mean squared error (MSE) can be modeled as $e _ { t e s t } ^ { 2 } ( n ) = \dot { b } i a s ^ { 2 } + n o i s e ^ { 2 } + v a r ( n )$ , where “noise” is irreducible error due to non-unique mapping from inputs to labels, and variance can be modeled as $v a r ( n ) = \sigma ^ { 2 } / n$ for $n$ training samples.
The $\eta n ^ { - 0 . 5 }$ term appears throughout machine learning generalization theory. For example, the bounds based on hypothesis VC-dimension (Vapnik & Chervonenkis, 1971) and Rademacher Complexity (Gnecco & Sanguineti, 2008) are both $\bar { O } ( c n ^ { - 0 . 5 } )$ where $c$ depends on the complexity of the classification model. More recent work also follows this form. We give some examples of bounds in Table 2 without describing all of the parameters because the point is that the test error bounds vary with training size $n$ as a function of $\bar { n ^ { - 0 . 5 } }$ , for all approaches.
Table 2: Generalization bound examples: The bounds each predict generalization error increasing as a function of $n ^ { - 0 . 5 }$ . Note: variable notation is consistent only within each line, except $n$ .
<table><tr><td>Work</td><td>Key Variables</td><td>Bound</td></tr><tr><td>Neyshabur et al. (2018)</td><td>network depth d</td><td>0(n-0.5Bd) </td></tr><tr><td>Bartlett et al.(2017)</td><td>spectral complexity Rw</td><td>(Rlg(max hi)+n−0.5) 0 γn</td></tr><tr><td>Arora et al. (2018)</td><td>compressibility toqparameters withr discrete values</td><td>O(n-0.5√qlogr)</td></tr><tr><td></td><td>Bousquet & Elisseeff (2Oo2)based on analysis of stability with margin </td><td>O(n-0.5/2)</td></tr></table>
# 2.2 EMPIRICAL STUDIES
Some recent empirical studies (e.g. Sun et al. (2017)) claim a log-linear relationship between error and training size, but this holds only when asymptotic error is zero. Hestness et al. (2017) model error as $e _ { t e s t } ( n ) = \alpha + \eta n ^ { \gamma }$ but often find $\gamma$ much smaller in magnitude than $- 0 . 5$ and suggest that poor fits indicate need for better hyperparameter tuning. This raises an interesting point that sample efficiency depends both on the classification model and on the efficacy of the optimization algorithm and parameters. Johnson & Nguyen (2017) also find a better fit with this extended power law model than by restricting $\gamma = - 0 . 5$ or $\alpha = 0$ . We find that, by selecting the learning rate through validation on one training size and using the Ranger optimizer (Wright, 2019), we can achieve a good approximate fit with $\gamma = - 0 . 5$ and best fit with $- 0 . 3 < \gamma < - 0 . 7$ .
In the language domain, learning curves are used in a fascinating study by Kaplan et al. (2020). For natural language transformers, they show that a power law relationship between logistic loss, model size, compute time, and dataset size is maintained if (and only if) each is increased in tandem. We draw some similar conclusions to their study, such as that increasing model size tends to improve performance especially for small training sets (which surprised us). However, the studies are largely complementary, as we study convolutional nets in computer vision, classification error (instead of logistic loss), and a broader range of design choices such as effects across depth, width, data augmentation, pretraining source, architecture, and dataset. Also related, Rosenfeld et al. (2020) model error as a function of both training size and number of model parameters with a five-parameter function that accounts for training size, model parameter size, and chance performance.
A key difference in our work is that we focus on how to best draw insights about design choices from learning curves, rather than on extrapolation. As such, we propose methods to estimate learning curves and their variance from a relatively small number of trained models.
# 2.3 PROPOSED CHARACTERIZATION OF LEARNING CURVES FOR EVALUATION
A classifier’s performance can be characterized in terms of its error and data-reliance, or how quickly the error changes with training size $n$ . With $e ( n ) = \alpha + \eta n ^ { \gamma }$ , we find that $\gamma = - 0 . 5$ provides a good local approximation but that fitting $\gamma$ significantly improves leave-one-size-out RMS error and extrapolation accuracy, as we detail in Sec. 4. However, $\alpha , \eta _ { \mathrm { { ; } } }$ , and $\gamma$ cannot be meaningfully compared across curves because the parameters have high covariance with small data perturbations, and comparing $\eta$ values is not meaningful unless $\gamma$ is fixed and vice-versa.
We propose to report error and sensitivity to training size in a way that can be derived from various learning curve models and is insensitive to data perturbations. The curve is characterized by error $e _ { N } = \alpha + \eta N ^ { \gamma }$ and data-reliance $\beta _ { N }$ at $N$ , and we typically choose $N$ as the full dataset size. Noting that most learning curves are locally well approximated by a model linear in $n ^ { - 0 . 5 }$ , we compute data-reliance as βN = N −0.5 $\begin{array} { r } { \dot { \beta } _ { N } = N ^ { - 0 . 5 } \ \frac { \partial e ^ { - } } { \partial n ^ { - 0 . 5 } } | _ { n = N } = - 2 \eta \gamma N ^ { \gamma } } \end{array}$ . When the error is plotted against $n ^ { - 0 . 5 }$ , $\beta _ { N }$ is the slope at $N$ scaled by $N ^ { - 0 . 5 }$ , where the scaling was chosen to make the practical implications of $\beta _ { N }$ more intuitive. This yields a simple predictor for error when changing training size by a factor of $d$ :
$$e ( d \cdot N ) = e _ { N } + \left( \frac { 1 } { \sqrt { d } } - 1 \right) \beta _ { N } .$$
Thus, by this linearized estimate, asymptotic error is $e _ { N } - \beta _ { N }$ , a 4-fold increase in data (e.g. $4 0 0 $ 1600) reduces error by $0 . 5 \beta _ { N }$ , and using only one quarter of the dataset (e.g. $4 0 0 1 0 0$ ) increases the error by $\beta _ { N }$ . For two models with similar $e _ { N }$ , the one with a larger $\beta _ { N }$ would outperform with more data but underperform with less. Note that $( e _ { N } , \beta _ { N } , \gamma )$ is a complete re-parameterization of the extended power law, with $\gamma + 0 . 5$ indicating the curvature in $n ^ { - 0 . 5 }$ scale.
# 3 ESTIMATING LEARNING CURVES
We now describe the method for estimating the learning curve from error measurements with confi the model is trained old $e _ { i j }$ samples (either per class or in total). We ssume $j ^ { \mathrm { t h } }$ $n _ { i }$ $\{ e _ { i j } \} _ { j = 1 } ^ { F _ { i } }$ $\mathcal { N } ( \mu _ { i } , \sigma _ { i } ^ { 2 } )$ $\alpha$ ror), $\eta$ , and $\gamma$ , such that $e _ { i j } \ : = \ : \alpha + \eta n _ { i } ^ { \gamma } + \epsilon _ { i j }$ where $\epsilon _ { i j } \sim \mathcal { N } ( 0 , \bar { \sigma } _ { i } ^ { 2 } )$ and $\mu _ { i j } = { \bar { \mathbb { E } } } [ e _ { i j } ] = \mu _ { i }$ .
Sections 3.1 and 3.2 describe how to estimate mean and variance of $\alpha$ and $\eta$ for a given $\gamma$ , and Sec. 3.3 describes our approach for estimating $\gamma$ .
# 3.1 WEIGHTED LEAST SQUARES FORMULATION
We estimate learning curve parameters $\{ \alpha , \eta \}$ by optimizing a weighted least squares objective:
$$\mathcal { G } ( \gamma ) = \operatorname* { m i n } _ { \alpha , \eta } \sum _ { i = 1 } ^ { S } \sum _ { j = 1 } ^ { F _ { i } } w _ { i j } \left( e _ { i j } - \alpha - \eta n ^ { \gamma } \right) ^ { 2 }$$
where $w _ { i j } = 1 / ( F _ { i } \sigma _ { i } ^ { 2 } )$ . $F _ { i }$ is the number of models trained with data size $n _ { i }$ and is used to normalize the weight so that the total weight for observations from each training size does not depend on $F _ { i }$ . The factor of $\sigma _ { i } ^ { 2 }$ accounts for the variance of $\epsilon _ { i j }$ . Assuming constant $\bar { \sigma } _ { i } ^ { 2 }$ and removing the $F _ { i }$ factor would yield unweighted least squares.
The variance of the estimate of $\sigma _ { i } ^ { 2 }$ from $F _ { i }$ samples is $2 \sigma _ { i } ^ { 4 } / F _ { i }$ , which can lead to over- or underweighting data for particular $i$ if $F _ { i }$ is small. Recall that each sample $e _ { i j }$ requires training an entire model, so $F _ { i }$ is always small in our experiments. We would expect the variance to have the form $\sigma _ { i } ^ { 2 } = \sigma _ { 0 } ^ { 2 } + \hat { \sigma } ^ { 2 } / n _ { i }$ , where $\sigma _ { 0 } ^ { 2 }$ is the variance due to random initialization and optimization and ${ \hat { \sigma } } ^ { 2 } / n _ { i }$ is the variance due to randomness in selecting $n _ { i }$ samples. Indeed, by averaging over the variance estimates for many different network models on the CIFAR-100 (Krizhevsky, 2012) dataset, we find a good fit with $\sigma _ { 0 } ^ { 2 } = 0 . 2$ . This enables us to estimate a single $\hat { \sigma } ^ { 2 }$ parameter from all samples $\mathbf { e }$ in a given learning curve as a least squares fit and also upper-bounds $w _ { i j } < = 5$ even if two models happen to have the same error. This attention to $w _ { i j }$ may seem fussy, but without such care we find that the learning curve often fails to account sufficiently for all the data in some cases.
# 3.2 SOLVING FOR LEARNING CURVE MEAN AND VARIANCE
dimension Concatenating errors across dataset sizes (indexed by $\textstyle D = \sum _ { i = 1 } ^ { S } F _ { i }$ . For each $d \in \{ 1 , \cdots , D \} , e [ d$ $i$ ) and folds results in an error vector ] is an observation of error at dataset size of $n _ { i _ { d } }$ that follows $\mathcal { N } ( \mu _ { i _ { d } } , \sigma _ { i _ { d } } ^ { 2 } )$ with $i _ { d }$ mapping $d$ to the corresponding .
The weighted least squares problem can be formulated as solving a system of linear equations denoted by $W ^ { 1 / 2 } e ~ = ~ W ^ { 1 / 2 } A \pmb { \theta }$ , where $W \in \mathbb { R } ^ { D \times D }$ is a diagonal matrix of weights $W _ { d d } = w _ { d }$ , $A \in \mathbb { R } ^ { D \times 2 }$ is a matrix with $A [ d , : ] = [ 1 n _ { d } ^ { \gamma } ]$ , and $\pmb { \theta } = \left[ \alpha \eta \right] ^ { T }$ are the parameters of the learning curve, treating $\gamma$ as fixed for now. The estimator for the learning curve is then given by $\pmb { \hat { \theta } } = ( W ^ { 1 / 2 } A ) ^ { + } W ^ { 1 / 2 } \pmb { e } = M \pmb { e }$ , where $M \in \mathbb { R } ^ { 2 \times D }$ and $^ +$ is pseudo-inverse operator.
We compute a mean curve using
$$\overline { { \pmb { \theta } } } = \mathbb { E } [ \pmb { \hat { \theta } } ] = M \mathbb { E } [ \pmb { e } ] = M \pmb { \mu }$$
$\pmb { \mu } \in \mathbb { R } ^ { D }$ with $\mu [ d ] = \hat { \mu } _ { i _ { d } }$ computed by empirical estimate as $\textstyle \sum _ { j = 1 } ^ { F _ { i } } e _ { i j } / F _ { i }$
The covariance of the estimator is given by
$$\Sigma _ { \hat { \pmb { \theta } } } = M \Sigma _ { e } M ^ { T }$$
where $\Sigma _ { \hat { \pmb { \theta } } } \in \mathbb { R } ^ { 2 \times 2 }$ and $\Sigma _ { e } \in \mathbb { R } ^ { D \times D }$ is the covariance of $e$ , where $\Sigma _ { e } [ d _ { 1 } , d _ { 2 } ] = \sigma _ { i _ { d _ { 1 } } } ^ { 2 }$ if $i _ { d _ { 1 } } = i _ { d _ { 2 } }$ and 0 otherwise. We compute our empirical estimate of $\sigma _ { i } ^ { 2 }$ as described in Sec. 3.1.
Since the curve is given by $e ( n ) = [ 1 n ^ { \gamma } ] \pmb { \theta }$ , the mean curve can be computed as
$$\begin{array} { r } { \overline { { e } } ( n ) = [ 1 \quad n ^ { \gamma } ] \overline { { \theta } } = \overline { { \alpha } } + \overline { { \eta } } n ^ { \gamma } . } \end{array}$$
The $9 5 \%$ bounds at any $n$ can be computed as $\overline { { e } } ( n ) \pm 1 . 9 6 \times \hat { \sigma } ( n )$ with
$$\hat { \sigma } ^ { 2 } ( n ) = [ 1 n ^ { \gamma } ] \Sigma _ { \hat { \theta } } \left[ \begin{array} { l } { 1 } \\ { n ^ { \gamma } } \end{array} \right]$$
where $\hat { \alpha }$ and $\hat { \eta }$ are the empirical estimates of $\alpha$ and $\eta$ . These confidence bounds reflect the variance in error measurements, assuming the parameterization is capable of fitting the true mean.
# 3.3 ESTIMATING $\gamma$
We search for $\gamma$ that minimizes the weighted least squares objective with an L1-prior that slightly encourages values close to 0.5. Specifically, we solve
$$\operatorname* { m i n } _ { \gamma \in ( - 1 , 0 ) } \mathcal { G } ( \gamma ) + \lambda | \gamma + 0 . 5 |$$
by searching over $\gamma \in \{ - 0 . 9 9 , . . . , - 0 . 0 1 \}$ with $\lambda = 5$ for our experiments.
# 4 EXPERIMENTS
We describe our implementation details in Sec. 4.1, apply learning curves to gain insights about error and data-reliance in Sec. 4.2, and validate our choice of learning curve parameterization and fitting weights used in the least squares objective in Sec. 4.3.
# 4.1 IMPLEMENTATION DETAILS
We use Pytorch-Lightning (Falcon, 2019) for our implementation with various architectures, weight initializations, data augmentation, and linear or fine-tuning optimization.
Training: We train models with images of size $3 2 \times 3 2$ for CIFAR (Krizhevsky, 2012) and $2 2 4 \times 2 2 4$ for Places365 (Zhou et al., 2017) with a batch size of 64 (except for Wide-ResNet101 and WideResNeXt101, where we use a batch size of 32 and performed one optimizer step every two batches). For each experiment setting, we conduct a learning rate search on a subset of the training data and choose the learning rate with the highest validation accuracy, and use it for all other subsets. We determine each fold’s training schedule on a mini-train/mini-val split of 2:1 on the train set. Each time the mini-val error stops decreasing for some epochs (“patience”), we revert to the best epoch and decrease the learning rate to $10 \%$ , and we perform this twice. Then we use this optimal mini-train learning rate schedule and ending epoch to train on the whole fold. The patience is $\propto 1 / \sqrt { n }$ , and is 5 at the $n = 4 0 0$ samples/class for CIFAR100/Places365 and 15 at the largest training size for other smaller datasets. We use a weight decay value of 0.0001. We use the Ranger optimizer (Wright, 2019), which combines Rectified Adam (Liu et al., 2019), Look Ahead (Zhang et al., 2019), and Gradient Centralization (Yong et al., 2020). In early experiments, we found Ranger to lead to lower error and to reduce sensitivity of hyperparameters, compared to vanilla SGD or Adam (Kingma & Ba, 2015).
Backbone Architecture: We use the default Pytorch implementations of all of the following architectures: AlexNet (Krizhevsky et al., 2012), ResNet-18, ResNet-50, ResNet-101 (He et al., 2015b), ResNeXt-50, ResNeXt-100 (Xie et al., 2016), VGG16 BN (Simonyan & Zisserman, 2014), Wide-ResNet-50, and Wide-ResNet-101 (Zagoruyko & Komodakis, 2016). For each architecture, we modify the last layer to match the same number of classes as the test dataset with Kaiming initialization (He et al., 2015a).
Number of Training Examples: To compute learning curves for CIFAR and Places365, we vary the number of training examples per class, partition the train set, and train one model per partition. For CIFAR100 (Krizhevsky, 2012), we use $\left\{ 2 5 , 5 0 , 1 0 0 , 2 0 0 , 4 0 0 \right\}$ training examples per class, and the number of models trained for each respectively is $\{ 1 6 , 8 , 4 , 2 , 1 \}$ . Similar to Hestness et al. (2017), we find training sizes smaller than 25 samples per class are strongly influenced by bounded error and deviate from our model. For Places365 dataset, we use $\{ 2 \bar { 5 } , 5 0 , 1 0 0 , 2 0 0 , 4 0 0 , 1 6 0 0 \}$ training examples per class and $\{ 1 6 , 8 , 4 , 3 , 3 , 1 \}$ models each. For other datasets (Fig. 6), we use $\{ 2 0 \% , \bar { 4 } 0 \% , 8 \bar { 0 } \% \}$ of the full data and train $\{ 4 , 2 , 1 \}$ models each. We hold out $20 \%$ of data from the original training set for testing (a validation set could also be used if available) to discourage metafitting on the test set. For example, we hold out 100 samples per class from the original CIFAR100 training set and perform hyperparameter selection and training on the remaining 400 samples.
Pretraining: When pretraining is used, we initialize models with pretrained weights learned through supervised training on ImageNet or Places365, or MOCO self-supervised training on ImageNet (He et al., 2020). Otherwise, weights are randomly initialized with Kaiming initialization.
Data Augmentation: For CIFAR, we pad by 4 pixels and use a random $3 2 \times 3 2$ crop (test without augmentation), and for Places365 we use random-sized crop (Szegedy et al., 2015) to $2 2 4 \times 2 2 4$ and random flipping (center crop $2 2 4 \times 2 2 4$ test time). For remaining datasets, we follow the preprocessing in Zhai et al. (2020) that produced the best results when training from scratch.
Linear vs. Fine-tuning: For “linear”, we only train the final classification layer, with the other weights frozen to initialized values. All weights are trained when “fine-tuning”.
# 4.2 LEARNING CURVE COMPARISONS
We plot the fitted learning curves and confidence bounds, with observed test errors as black points. The legend displays $\gamma$ , error $e _ { N }$ , and data reliance $\beta _ { N }$ with $N = 4 0 0$ . The $\mathbf { X }$ -axis is in scale $n ^ { - 0 . 5 }$ $\mathbf { \xi } _ { n }$ in parentheses), but bestfitting $\gamma$ is used in all cases.In all plots, $n$ denotes number of samples per class except Fig. 6 where $n$ is the total number of samples. A vertical bar indicates $n = 1 6 0 0$ , which we consider the limit of accurate extrapolation from curves fit to $n \leq 4 0 0$ samples. All points are used for fitting, except in Fig. 9b $n = 1 6 0 0$ is held out to test extrapolation.
 Figure 1: Architecture (w/ finetuning)
Network architecture: Advances in CNN architectures have reduced number of parameters while also reducing error over the range of training sizes. On CIFAR100,
AlexNet has 61M parameters; VGG-16, 138M; ResNet-50, 26M; ResNeXt-50, 25M; and ResNet101, 45M. Fig. 1 shows that each major advance through ResNet reduces both data-reliance and $e _ { 4 0 0 }$ , while ResNeXt appears to slightly reduce $e _ { 4 0 0 }$ without change to data-reliance.
 Figure 2: Pretraining and fine-tuning with ResNet-18.
Pretraining and fine-tuning: In Fig. 2 we see that, for linear classifiers, pretraining leads to a huge improvement in $e _ { 4 0 0 }$ though with a moderate increase in data-reliance. When fine-tuning, the pretraining greatly reduces datareliance $\beta _ { 4 0 0 }$ and also reduces $e _ { 4 0 0 }$ . Pretraining clearly improves performance with smaller training sizes. However, we cannot draw conclusions about bias because extrapolated asymptotic error is not reliable, and the full story is complicated. On an object detection task, He et al. (2019) find that, with long learning schedules, randomly initialized networks approach the performance of pretrained networks (for the CNN backbone), even with finite data. Experiments by Zoph et al. (2020), also on object detection, show that pretraining can sometimes harm performance when strong data augmentation is used. Kornblith et al. (2019) show that fine-tuned pretrained models outperform randomly initialized models on many datasets, but the gap is often small and narrows as data size grows. All agree that pretraining is at least important for providing a warm start that greatly reduces the training time, but whether it introduces bias (i.e. asymptotic error) likely depends on the tasks, domains, and optimization settings.
 Figure 3: Pretraining sources (test on Cifar100).
Pretraining data sources: In Fig. 3, we compare pretraining strategies: random, supervised on ImageNet or Places365, and self-supervised on ImageNet (MOCO by He et al. (2020)). All initializations have similar extrapolated error at $n = 1 6 0 0$ , but different data-reliance. Self-supervised MOCO leads to lower $e _ { 4 0 0 }$ and $\beta _ { 4 0 0 }$ compared to Places365 pretraining. Supervised pretraining on ImageNet has the lowest $e _ { 4 0 0 }$ and $\beta _ { 4 0 0 }$ . We suspect that the $\gamma = - 0 . 6 7$ and higher extrapolated asymptotic error may be due to measurement noise and suboptimal hyperparameter selection.
 Figure 4: Depth, width, and ensembles on Cifar100.
Network depth, width, and ensembles: The classical view is that smaller datasets need simpler models to avoid overfitting. In Figs. 4a, 4b, we show that, not only do deeper networks have better potential at higher data sizes, their data reliance does not increase (nearly parallel and drops a little for fine-tuning), making deeper networks perfectly suitable for smaller datasets. For linear classifiers (Fig. 4b), the deeper networks provide better features, leading to consistent drop in $e _ { 4 0 0 }$ . The small jump in data reliance between Resnet-34 and Resnet-50 may be due to the increased last layer input size from 512 to 2048 nodes. When increasing width, the fine-tuned networks (Fig. 4c) have reduced $e _ { 4 0 0 }$ without much change to data-reliance. With linear classifiers (Fig. 4d), increasing the width leads to little change or even increase in $e _ { 4 0 0 }$ with slight decrease in data-reliance. Rosenfeld et al. (2020) show that error can be modeled as a function of either training size, model size, or both. Modeling both jointly can provide additional capabilities such as selecting model size based on data size, but requires many more experiments to fit the curve.
An alternative to using a deeper or wider network is forming ensembles. In Figure 4e, we find that while an ensemble of six ResNet-18’s (each 11.7M parameters) improves over a single model, it has higher $e _ { 4 0 0 }$ and data-reliance than ResNet-101 (44.5M), Wide-ResNet-50 (68.9M), and WideResNet-101 (126.9M). Three ResNet-50’s (each 25.6M) underperforms Wide-ResNet-50 on $e _ { 4 0 0 }$ but outperforms for small amounts of data due to lower data reliance.
 Figure 5: Data augmentation on Places365.
Data Augmentation: One may expect that data augmentation acts as a regularizer with reduced effect for large training sizes, or even possibly negative effect due to introducing bias. However, Fig. 5 shows that data augmentation on Places365 reduces error for all training sizes with little or no change to data-reliance when fine-tuning. $e ( n )$ with augmentation roughly equals $e ( 1 . 8 n )$ without it, supporting the view that augmentation acts as a multiplier on the value of an example. For the linear classifier, data augmentation has little apparent effect due to low data-reliance, but the results are still consistent with this multiplier.
Additional datasets: In Fig. 6, we verify that our learning curve model fits to multiple other datasets (chosen from natural tasks in Zhai et al. (2020)), comparing fine-tuned vs. linear with Resnet-18. For these plots only, $n$ is the total number of samples. The $\gamma$ values are estimated from data, but the prior has more effect here due to fewer error measurements.
We see fine-tuning consistently outperforms linear, though the difference is most dramatic for Sun397. Pretraining provides large benefits across datasets.
 Figure 6: Additional datasets
# 4.3 EVALUATION OF LEARNING CURVES MODEL AND FITTING
We validate our learning curve model using leave-one-size-out prediction error, for example, predicting empirical mean performance with 400 samples per class based on observing error from models trained on 25, 50, 100, and 200 samples. We consider various choices of weighting schemes ( $w$ ’s in Eq. 2) and estimating different parameters in a general form of the learning curve given by $e ( n ) = \alpha { \dot { + } } \eta n ^ { \gamma } + \delta n ^ { 2 \gamma }$ . Note that setting $\delta = 0$ yields the learning curve model described in Sec. 3.
Weighting Schemes. In the Fig. 7 table, we compare three weighting schemes across 16 classifiers: $w _ { i j } = 1$ is unweighted; $w _ { i j } \stackrel { \mathbf { \textstyle = } } { = } 1 / \sigma _ { i } ^ { 2 }$ is weighted by estimated size-dependent standard deviation; $\dot { w _ { i j } } = 1 / ( F _ { i } \sigma _ { i } ^ { 2 } )$ makes the total weight for a given dataset size invariant to the number of folds. On average our proposed weighting performs best with high significance compared to unweighted. The p-value is paired t-test of difference of means calculated across all dataset sizes.
Model Choice. We consider other parameterizations that are special cases of $e ( n ) = \alpha + \eta n ^ { \gamma } + \delta n ^ { 2 \gamma }$ The table in Fig. 7 shows that the parameterization used for our experiments outperforms the others, in most cases with high significance, and achieves a very good fit with $R ^ { 2 }$ of 0.998.
Model Stability. We test stability and sample requirements by repeatedly fitting curves to four resampled data points for a model (Resnet-18, no pretraining, fine-tuned, tested on Places365). Based on estimates of mean and standard deviation, one point each at $n = \{ 5 0 , 1 0 0 , 2 0 0 , 4 0 0 \}$ is sampled and used to fit a curve, repeated 100 times. Parentheses in legend show standard deviation of estimates of $e _ { N }$ , $\beta _ { N }$ , and $\gamma$ . Our preferred model extrapolates best to $n = 1 6 0 0$ and $n = 2 5$ while retaining stable estimates of of $e _ { N }$ and $\beta _ { N }$ , but predicted asymptotic error $\alpha$ varies widely.
Appendix C shows similar estimates of $e _ { N }$ and $\beta _ { N }$ by fixing $\gamma = - 0 . 5$ and fitting only $\alpha$ and $\eta$ on the three largest sizes (typically $n = \{ 1 0 0 , 2 0 0 , 4 0 0 \} \rangle$ , indicating that a lightweight approach of training a few models can yield similar conclusions.

Figure 7: Learning curve model and weights validation. See text for explanation.
<table><tr><td></td><td></td><td></td><td colspan="7">RMSE</td></tr><tr><td>Params</td><td>Weights</td><td>R²</td><td>25</td><td>50</td><td>100</td><td>200</td><td>400</td><td>avg</td><td>p-value</td></tr><tr><td rowspan="4">α,n,</td><td>1</td><td>0.998</td><td>2.40</td><td>0.86</td><td>0.54</td><td>0.57</td><td>0.85</td><td>1.04</td><td>-</td></tr><tr><td></td><td>0.999</td><td>2.38</td><td>0.83</td><td>0.69</td><td>0.54</td><td>1.08</td><td>1.10</td><td>0.06</td></tr><tr><td></td><td>0.998</td><td>2.66</td><td>0.86</td><td>0.79</td><td>0.50</td><td>1.26</td><td>1.21</td><td>0.008</td></tr><tr><td></td><td>0.988</td><td>3.41</td><td>1.09</td><td>0.69</td><td>0.72</td><td>1.21</td><td>1.42</td><td><0.001</td></tr><tr><td>α,n a,n,</td><td>谢 南</td><td>0.999</td><td>2.89</td><td>0.74</td><td>0.68</td><td>0.56</td><td>0.94</td><td>1.16</td><td>0.05</td></tr><tr><td>a,nd,</td><td>新</td><td>0.999</td><td>3.46</td><td>0.74</td><td>0.70</td><td>0.59</td><td>1.00</td><td>1.30</td><td>0.02</td></tr></table>
# 5 LIMITATIONS AND FUTURE WORK
Limitations: Our work in this paper is limited to classification loss, and our model does not account for small sample effects where chance performance is a major factor. Although our proposed $e _ { N }$ and $\beta _ { N }$ are stable under perturbations and different learning curve parameterizations, the asymptotic error $\alpha$ and exponent $\gamma$ parameters of the learning curve are unstable, and our confidence interval does not account for $\gamma$ variance. Unstable $\alpha$ means that little can be concluded about asymptotic performance, though $e _ { N } - \beta _ { N }$ can stand in as a measure of large-data performance. Unstable $\gamma$ may mean that conclusions are subject to the hyperparameter selection and optimization method.
Future work: Do the hyperparameters such as learning rate, schedule, and weight decay determine $\gamma$ , or something else? It appears that $\gamma \ : < \ : - 0 . 5$ is accompanied by high $\alpha$ and/or $\eta$ . Should $\gamma = - 0 . 5$ for a well-trained system? Answering these questions could lead to improved training and evaluation methodologies. It would also be interesting to investigate learning curve models for small training size, other losses and prediction types, more design parameters and interactions, and impact of imbalance in class distribution.
Appendix A offers extended discussion. Appendix B provides a guide to fitting, displaying, and using learning curves. Appendix C contains a table of learning curves for all of our experiments and compares $e _ { N }$ and $\beta _ { N }$ produced by two learning curve models.
# 6 CONCLUSION
We investigate learning curve models for analyzing classifier design decisions. We find an extended power law provides the best fit across many different architectures, datasets, and other design parameters. We propose to characterize error and data-reliance with $e _ { N }$ and $\beta _ { N }$ , which are stable under data perturbations and can be derived from different learning curve models. Our experiments lead to several interesting observations about impacts of pretraining, fine-tuning, data augmentation, depth, width, and ensembles. We anticipate learning curves can further inform training methodology, continual learning, and representation learning, among other problems, and hope to see learning curves become part of a standard classification evaluation.
# REFERENCES
Sanjeev Arora, Rong Ge, Behnam Neyshabur, and Yi Zhang. Stronger generalization bounds for deep nets via a compression approach. CoRR, abs/1802.05296, 2018. URL http://arxiv. org/abs/1802.05296.
Peter L. Bartlett, Dylan J. Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks. CoRR, abs/1706.08498, 2017. URL http://arxiv.org/abs/1706. 08498.
O. Bousquet and A. Elisseeff. Stability and generalization. Journal of Machine Learning Research, 2:499–526, 2002.
Corinna Cortes, L. D. Jackel, Sara A. Solla, Vladimir Vapnik, and John S. Denker. Learning curves: Asymptotic values and rate of convergence. In NIPS, 1993.
Pedro Domingos. A unified bias-variance decomposition. In ICML, 2000.
WA Falcon. Pytorch lightning. GitHub. Note: https://github.com/PyTorchLightning/pytorchlightning, 3, 2019.
Stuart Geman, Elie Bienenstock, and Rene Doursat. Neural networks and the bias/variance dilemma. ´ Neural Computation, 4:1–58, 01 1992. doi: 10.1162/neco.1992.4.1.1.
Giorgio Gnecco and Marcello Sanguineti. Approximation error bounds via rademacher’s complexity. 2(4), 2008.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015a.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015b. URL http://arxiv.org/abs/1512.03385.
Kaiming He, Ross Girshick, and Piotr Dollar. Rethinking imagenet pre-training. pp. 4917–4926, 10 2019. doi: 10.1109/ICCV.2019.00502.
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729–9738, 2020.
Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory F. Diamos, Heewoo Jun, Hassan Kianinejad, Md. Mostofa Ali Patwary, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. CoRR, 2017.
Mark Johnson and Dat Quoc Nguyen. How much data is enough? Predicting how accuracy varies with training data size. Technical report, 2017.
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models, 2020.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
S. Kornblith, J. Shlens, and Q. V. Le. Do better imagenet models transfer better? In CVPR, 2019.
Alex Krizhevsky. Learning multiple layers of features from tiny images. University of Toronto, 05 2012.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 1097– 1105. Curran Associates, Inc., 2012. URL http://papers.nips.cc/paper/ 4824-imagenet-classification-with-deep-convolutional-neural-networks. pdf.
Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the variance of the adaptive learning rate and beyond. arXiv preprint arXiv:1908.03265, 2019.
Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ Skz_WfbCZ.
Jonathan S. Rosenfeld, Amir Rosenfeld, Yonatan Belinkov, and Nir Shavit. A constructive prediction of the generalization error across scales. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ ryenvpEKDr.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. URL http://arxiv.org/abs/1409.1556.
Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In IEEE International Conference on Computer Vision, pp. 843–852, 2017.
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015.
Mingxing Tan and Quoc V Le. EfficientNet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
Alexandre B. Tsybakov. Introduction to Nonparametric Estimation. Springer Publishing Company, Incorporated, 1st edition, 2008. ISBN 0387790519.
V. N. Vapnik and A. Ya. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Probability and its Applications, 16(2):264–280, 1971. doi: 10.1137/1116025. URL http://link.aip.org/link/?TPR/16/264/1.
Less Wright. New deep learning optimizer, ranger: Synergistic combination of radam $^ +$ lookahead for the best of both. Github https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer, 08 2019.
Saining Xie, Ross B. Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated resid- ´ ual transformations for deep neural networks. CoRR, abs/1611.05431, 2016. URL http: //arxiv.org/abs/1611.05431.
Hongwei Yong, Jianqiang Huang, Xiansheng Hua, and Lei Zhang. Gradient centralization: A new optimization technique for deep neural networks. ArXiv, abs/2004.01461, 2020.
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. CoRR, abs/1605.07146, 2016. URL http://arxiv.org/abs/1605.07146.
Xiaohua Zhai, Joan Puigcerver, Alexander Kolesnikov, Pierre Ruyssen, Carlos Riquelme, Mario Lucic, Josip Djolonga, Andre Susano Pinto, Maxim Neumann, Alexey Dosovitskiy, Lucas Beyer, Olivier Bachem, Michael Tschannen, Marcin Michalski, Olivier Bousquet, Sylvain Gelly, and Neil Houlsby. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2020.
Michael Ruogu Zhang, James Lucas, Geoffrey E. Hinton, and Jimmy Ba. Lookahead optimizer: k steps forward, 1 step back. In NeurIPS, 2019.
Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
Barret Zoph, Golnaz Ghiasi, Tsung-Yi Lin, Yin Cui, Hanxiao Liu, Ekin D. Cubuk, and Quoc V. Le. Rethinking pre-training and self-training, 2020.
# A EXTENDED DISCUSSION
Evaluation methodology is the foundation of research, impacting how we choose problems and rank solutions. Large train and test sets now serve as the fuel and crucible to refine machine learning methods. The current evaluation standard of using fixed i.i.d. train/test sets has supported many classification model improvements, but as machine learning broadens to continual learning, representation learning, long-tail learning, and so on, we need evaluation methods that better reflect the uncontrollable, unpredictable, and ever-changing world. By characterizing performance in terms of error and data-reliance, we can provide a more complete understanding of model design and training size impact than single-point error. With that perspective, we discuss the limitations of our experiments and directions for future work.
• Cause and impact of $\gamma$ : We speculate that $\gamma$ is largely determined by hyperparameters and optimization rather than model design, so conclusions are conditioned on particular training parameters. This presents an opportunity to identify poor training regimes and improve them. Intuitively, one would expect that more negative $\gamma$ values are better (i.e. $\gamma = - 1$ preferable to $\gamma = - 0 . 5 )$ , since the curve is curve $O ( n ^ { \gamma } )$ , but we find the highmagnitude $\gamma$ tends to come with high asymptotic error, indicating that the efficiency comes at cost of over-commitment to initial conditions. We speculate (but with some disagreement among authors) that $\gamma = - 0 . 5$ is an indication of a well-trained curve and will generally outperform curves with higher or lower $\gamma$ , given the same classification model. It would be interesting to examine the impact of hyperparameter selection and optimization method on $\gamma$ .
• Small training sets: Error is bounded and, with small training sets, classifier performance may be modeled as transitioning from random guess to informed prediction, as shown by Rosenfeld et al. (2020). We do not model performance with very small training size, partly to keep our model simple, partly because small training performance can be easily measured empirically, and partly because performance with small training size is highly variable depending on the sample. However, studying performance with small training sizes could be interesting, particularly to determine whether design decisions have an impact at the small size that is not apparent at larger sizes.
• Losses and Prediction types: We analyze multiclass classification error, but the same analysis could likely be extended to other losses and prediction types. For example, Kaplan et al. (2020) analyze learning manifolds of cross-entropy loss, which is unbounded, of language model transformers. Problems like object detection or grounding sometimes have relatively complex evaluation measures, such as average precision after accounting for localization and label accuracy, but test evaluation of the same losses used for training should still apply. Sun et al. (2017) show an approximately log-linear behavior between mean intersection of union semantic segmentation error as a function of number of training samples.
More design parameters and interactions: The interaction between data scale, model scale, and performance is well-explored by Kaplan et al. (2020) and Rosenfeld et al. (2020), but it could also be interesting to explore interactions, e.g. between class of architecture (e.g. VGG, ResNet, EfficientNet (Tan & Le, 2019)) and some design parameters, to see how ideas such as skip-connections, residual layers and creating bottlenecks influence performance. More extensive evaluation of data augmentation, representation learning, optimization and regularization methods would also be interesting.
• Unbalanced class distributions: In most of our experiments, we use equal number of samples per class. Further experimentation is required to determine whether class imbalance impacts the form of the learning curve.
# B USER’S GUIDE TO LEARNING CURVES
# B.1 USES FOR LEARNING CURVES
• Comparison: When comparing two learners, measuring the error and data-reliance provides a better understanding of the differences than evaluating single-point error. We compare curves with $e _ { N }$ and $\beta _ { N }$ , rather than directly using the curve parameters, because they are more stable under data perturbations and do not depend on the parameterization, instead corresponding to error and rate of change about $n = N$ . $e _ { N } - \beta _ { N }$ can be used as a measure of large-sample performance.
• Performance extrapolation: A $1 0 \mathrm { x }$ increase in training data can require a large investment, sometimes millions of dollars. Learning curves can predict how much performance will improve with the additional data to judge whether the investment is worthwhile.
• Model selection: When much training data is available, architecture, hyperparameters, and losses can be designed and selected using a small subset of the data to minimize the extrapolated error of the full training set size. Higher-parameter models such as in Kaplan et al. (2020) and Rosenfeld et al. (2020) may be more useful as a mechanism to simultaneously select scale parameters and extrapolate performance, though fitting those models is much more computationally expensive due to the requirement of sampling error/loss at multiple scales and data sizes.
Hyperparameter validation: A poor fitting learning curve (or one with $\gamma$ far from $- 0 . 5 )$ is an indication of poor choice of hyperparameters, as pointed out by Hestness et al. (2017).
# B.2 ESTIMATING AND DISPLAYING LEARNING CURVES
Use validation set: We recommend computing learning curves on a validation set, rather than a test set, according to best practice of performing a single evaluation on the test set for the final version of the algorithm. All of our experiments are on a validation set, which is carved from the official training set if necessary.
Generate at least four data points: In most of our experiments on CIFAR100, we train a 31 models: 1 on 400 images, 2 on 200 images, 4 on 100 images, 8 on 50 images, and 16 on 25 images. Each trained model provides one data point, the average validation error. In each case, the training data is partitioned so that the image sets within the same size are non-overlapping. Training multiple models at each size enables estimating the standard deviation for performing weighted least squares and producing confidence bounds. However, our experiments indicate that learning curves are highly stable, so a minimal experiment of training four models on the full, half, quarter, and eighth-size training set may be sufficient as part of a standard evaluation. See Fig. 8 It may be necessary to train more models if attempting to distinguish fine differences.
 Figure 8: Stability under sparse measurements: Sampled learning curves for Places365 fine-tuned without pretraining are shown for four different learning curve parameterizations. In each case, means and standard deviations (shown by error bars) are estimated for $n = 5 0$ , $n = 1 0 0$ , $n = 2 0 0$ , $n = 4 0 0$ , using all the data points shown as white circles. Then, 100 times, we sample one point each from a Guassian distribution and fit a learning curve to the four points. In parantheses, the legend shows the standard deviation of $e _ { N }$ , $\beta _ { N }$ , and $\gamma$ . Note that the parameterization of $\{ \alpha , \eta , \gamma \}$ extrapolates best to lower and higher data sizes while still producing stable estimates of $e _ { N }$ and $\beta _ { N }$ . Asymptotic error, however, varies widely.
Set hyperparameters: The learning rate and learning schedule are key parameters to be set. We have not experimented with changes to weight decay, momentum, or other hyperparameters.
Fit learning curves: If more than one data point is available for the same training size, the standard deviation can be estimated. As described in Sec. 3, we recommend fitting a model of $\sigma _ { i } ^ { 2 } = \sigma _ { 0 } ^ { 2 } +$ $\hat { \sigma } ^ { 2 } / n$ , where $\sigma _ { 0 } ^ { 2 }$ . $\sigma _ { 0 } ^ { 2 }$ is the variance due to randomness in initialization and optimization. The fitting is not highly sensitive to this parameter, so we recommend setting $\sigma _ { 0 } ^ { 2 } = 0 . { \dot { 0 } } 1$ and fitting $\hat { \sigma }$ to observations, since estimating both from experiments to generate a single learning curve introduces high variance and instability.
Display learning curves or parameters: As in this paper, learning curves can be plotted linearly with the $\mathbf { X }$ -axis as $n ^ { - 0 . 5 }$ and the y-axis as error. We choose this rather than log-linear because it reveals prediction of asymptotic error and yields a linear plot when $\gamma = - 0 . 5$ . Since space is often a premium, the learning curve parameters can be displayed instead, as illustrated in Table 3.
Table 3: Results: $\mathrm { \ m o d e l _ { 1 } }$ and model2 have similar percent test error when training on the full set. Fitting a learning curve on the validation set, we see that $\mathrm { \ m o d e l _ { 2 } }$ has higher data-reliance, so may outperform for larger training sets. This is a hypothetical example to illustrate use of learning curves in a table.
<table><tr><td></td><td>eN</td><td>βN</td><td>2</td></tr><tr><td>model1</td><td>25.3 %</td><td>4.6</td><td>-0.36</td></tr><tr><td>model2</td><td>25.2 %</td><td>8.4</td><td>-0.47</td></tr></table>
# C TABLE OF LEARNING CURVES
Table 4 shows experimental settings and fit parameters for learning curves under two parameterizations. We can see that similar $e _ { 4 0 0 }$ and $\beta _ { 4 0 0 }$ values are obtained when fixing $\gamma = - 0 . 5$ and fitting to errors with only three training sizes (RMS difference in $e _ { 4 0 0 }$ and $\gamma _ { 4 0 0 }$ are 0.42 and 0.95, respectively). This means that learning curves can be fit and compared without training a large number of additional models.
Table 4: Experiment settings and parameters: We show the datasets, architectures, settings, and learning rate (set by mini-train/val) used to train and test our classifiers. Next, we show the parameters fit using the extended power law model $e ( n ) = \alpha + \eta n ^ { - \gamma }$ . Next to that, we show the model resulting from setting $\gamma = - 0 . 5$ and fitting to only the three training sizes with highest n.
<table><tr><td></td><td colspan="2">dataset arch</td><td colspan="2"># param pretrain/init</td><td colspan="2">fine-tune?</td><td colspan="2">data aug? IrnRate</td><td colspan="2">extended power law n 7</td><td colspan="2">β400 α</td><td colspan="2">𝑛−0.5 linear fit to last 3 points e400 β400</td></tr><tr><td colspan="9">PRETRAIN_IN2CIFAR</td><td>e.400</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>No Pretr; Linear</td><td>CIFAR</td><td>Resnet-18</td><td>51K</td><td>Random</td><td>No</td><td>Yes</td><td>0.01</td><td>78.51 120.13</td><td>-0.84</td><td>79.29</td><td>1.32</td><td>78.06</td><td>26.12 79.36</td><td>1.31</td></tr><tr><td>No Pretr; Finetune</td><td>CIFAR</td><td>Resnet-18</td><td>11.7M</td><td>Random</td><td>Yes</td><td>Yes</td><td>0.01</td><td>5.68 259.29</td><td>-0.41</td><td>27.91</td><td>18.23</td><td>11.21 336.13</td><td>28.02</td><td>16.81</td></tr><tr><td>Pretr; Linear</td><td>CIFAR</td><td>Resnet-18</td><td>51K</td><td>ImageNet</td><td>No</td><td>Yes</td><td>0.0003</td><td>24.4 65.28</td><td>-0.35</td><td>32.42</td><td>5.61 27.33</td><td>102.16</td><td>32.44</td><td>5.11</td></tr><tr><td>Pretr; Finetune</td><td>CIFAR</td><td>Resnet-18</td><td>11.7M</td><td>ImageNet</td><td>Yes</td><td>Yes</td><td>0.001</td><td>12.48 194.19</td><td>-0.57</td><td>18.86</td><td>7.28 11.37</td><td>150.73</td><td>18.91</td><td>7.54</td></tr><tr><td colspan="9">PRETRAIN_IN2PLACES</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>No Pretr; Linear</td><td>Places</td><td>Resnet-18</td><td>187K</td><td>Random</td><td>No</td><td>Yes</td><td>0.03</td><td>91.84 19.13</td><td>-0.5</td><td>92.79</td><td>0.96 91.09</td><td>29.31</td><td></td><td>1.47</td></tr><tr><td>No Pretr; Finetune</td><td>Places</td><td>Resnet-18</td><td>11.7M</td><td>Random</td><td>Yes</td><td>Yes</td><td>0.001</td><td>33.16 117.45</td><td>-0.26</td><td>57.89</td><td>12.86</td><td>44.39 263.63</td><td>92.55 57.57</td><td>13.18</td></tr><tr><td>Pretr; Linear</td><td>Places Places</td><td>Resnet-18 Resnet-18</td><td>187K 11.7M</td><td>ImageNet ImageNet</td><td>No Yes</td><td>Yes Yes</td><td>0.0003 0.0003</td><td>54.43 53.39 40.92 70.04</td><td>-0.38 -0.28</td><td>59.91</td><td>4.16 56.11</td><td>76.95</td><td>59.95</td><td>3.85</td></tr><tr><td colspan="9">Pretr; Finetune</td><td>54</td><td>7.33 44.82</td><td>174.69</td><td>53.55</td><td>8.73</td></tr><tr><td>PRETRAIN_IN_PLACES_MOCO2CIFAR</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>No Pretr</td><td>CIFAR</td><td>Resnet-50</td><td>25.6M</td><td>Random</td><td>Yes</td><td>Yes</td><td>0.01</td><td>-2.23 243.44</td><td>-0.35</td><td>27.66</td><td>20.93</td><td>9.18 372.11</td><td>27.79</td><td>18.61</td></tr><tr><td>Pretr on Imagenet Pretr on Places</td><td>CIFAR CIFAR</td><td>Resnet-50 Resnet-50</td><td>25.6M 25.6M</td><td>ImageNet Places</td><td>Yes Yes</td><td>Yes Yes</td><td>0.001 0.001</td><td>15.11 178.61 -5.61 109.92</td><td>-0.67 -0.24</td><td>18.33</td><td>4.32</td><td>13.3 99.88</td><td>18.29</td><td>4.99</td></tr><tr><td colspan="9">Pretr on Imagenet with MOCO</td><td>20.49</td><td>12.53 10.07</td><td>9.05 195.43</td><td>18.82</td><td>9.77</td></tr><tr><td></td><td>CIFAR</td><td>Resnet-50</td><td>25.6M</td><td>ImageNet (MOCO)</td><td>Yes</td><td>Yes</td><td>0.0003</td><td>0.07 112.69</td><td>-0.3</td><td>18.74</td><td>11.21</td><td>210.67</td><td>20.61</td><td>10.53</td></tr><tr><td>DEPTH_FT</td><td>CIFAR</td><td>Resnet-18</td><td>11.7M</td><td></td><td>Yes</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="9">Resnet-18 Resnet-34</td><td></td><td>7.28</td><td>11.37</td><td>150.73</td><td></td><td>7.54</td></tr><tr><td>Resnet-50</td><td>CIFAR CIFAR</td><td>Resnet-34</td><td>21.8M</td><td>ImageNet ImageNet</td><td>Yes</td><td>Yes Yes</td><td>0.001 0.001</td><td>12.48 194.19 15.76 237.19</td><td>-0.57 -0.73</td><td>18.86 18.75</td><td></td><td>104.15</td><td>18.91</td><td></td></tr><tr><td></td><td></td><td>Resnet-50</td><td>25.6M</td><td>ImageNet</td><td>Yes</td><td>Yes</td><td>0.001</td><td>15.11 178.61</td><td>-0.67</td><td>18.33</td><td>4.36 13.51 4.32</td><td>13.3 99.88</td><td>18.72 18.29</td><td>5.21 4.99</td></tr><tr><td>Resnet-101</td><td>CIFAR</td><td>Resnet-101</td><td>44.5M</td><td>ImageNet</td><td>Yes</td><td>Yes</td><td>0.0003</td><td>10.91 166.44</td><td>-0.62</td><td>14.97</td><td>5.03 8.95</td><td>117.22</td><td></td><td>5.86</td></tr><tr><td>DEPTH_LINEAR</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>14.81</td><td></td></tr><tr><td>Resnet-18</td><td>CIFAR</td><td>Resnet-18</td><td>51K</td><td>ImageNet</td><td>No</td><td>Yes</td><td>0.001</td><td>24.4 65.28</td><td>-0.35</td><td>32.42</td><td></td><td></td><td></td><td></td></tr><tr><td>Resnet-34</td><td>CIFAR</td><td>Resnet-34</td><td>51K</td><td>ImageNet</td><td>No</td><td>Yes</td><td>0.001</td><td>21.77 59.56</td><td>-0.33</td><td>30.02</td><td>5.61 5.44</td><td>27.33 102.16</td><td>32.44</td><td>5.11</td></tr><tr><td>Resnet-50</td><td>CIFAR CIFAR</td><td>Resnet-50 Resnet-101</td><td>205K 205K</td><td>ImageNet ImageNet</td><td>No No</td><td>Yes Yes</td><td>0.0003 0.0003</td><td>13.5 56.54</td><td>-0.22</td><td>28.63</td><td>25.11 6.66 23.05</td><td>98.33 112.08</td><td>30.03 28.65</td><td>4.92 5.6</td></tr><tr><td colspan="9">Resnet-101</td><td></td><td></td><td>20.98</td><td>99.32</td><td></td><td>4.97</td></tr><tr><td>WIDTH_FT</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>11.17 51.7</td><td>-0.21</td><td>25.86</td><td>6.17</td><td></td><td>25.95</td><td></td></tr><tr><td>Resnet-50</td><td>CIFAR</td><td>Resnet-50</td><td>25.6M</td><td>ImageNet</td><td>Yes</td><td>Yes</td><td>0.001</td><td>178.61</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>2xWide-Resnet-50</td><td>CIFAR</td><td>Wide_Resnet-50.2</td><td>68.9M</td><td>ImageNet</td><td>Yes</td><td>Yes</td><td>0.0003</td><td>15.11 8.78 160.14</td><td>-0.67 -0.57</td><td>18.33</td><td>4.32</td><td>13.3 99.88</td><td>18.29</td><td>4.99</td></tr><tr><td>Resnet-101</td><td>CIFAR</td><td>Resnet-101</td><td>44.5M</td><td>ImageNet</td><td>Yes</td><td>Yes Yes</td><td>0.0003 0.0003</td><td>10.91 166.44</td><td>-0.62</td><td>14.04 14.97</td><td>6 7.83 5.03 8.95</td><td>124.55 117.22</td><td>14.06 14.81</td><td>6.23 5.86</td></tr><tr><td>2xWide-Resnet-101 WIDTH_LINEAR</td><td>CIFAR</td><td>Wide_Resnet-101.2</td><td>126.9M</td><td>ImageNet</td><td>Yes</td></table>
# D DRAFT ADDITIONAL CHANGES TO INCLUDE IN FINAL VERSION
This section contains preliminary results and text requested by reviewers that will be carefully integrated into the main document in final revision.
# D.1 OPTIMIZATION EXPERIMENTS
 Figure 9: Optimization on Cifar10 with ResNet-18.
In Fig. 9, we show results on Cifar10 when training ResNet-18 using four different optimization methods: Ranger (Wright, 2019), Adam (Kingma & Ba, 2015), stochastic gradient descent (SGD) w/ momentum, and SGD w/o momentum. Similarly to our experiments with Cifar100, we use $80 \%$ of the standard training set for training and validation (4000 examples per class) and the remaining $20 \%$ for testing. With pretraining, all methods perform similarly, but when training from scratch (no pretraining), Ranger outperforms with lower $e _ { 4 0 0 0 }$ and $\beta _ { 4 0 0 0 }$ . SGD without momentum performs the worst and is least consistent across folds.
# D.2 TEXT FOR SECTION 2.2
However, if the classifier parameters are functions of $n$ , then $\gamma$ may deviate from $- 0 . 5$ . For example, Tsybakov (2008) shows that a kernel density estimator (KDE) with fixed bandwidth $h$ has MSE boundedbecomes $\begin{array} { r } { O ( \frac { 1 } { n h } ) } \end{array}$ but whewhere he bandwidth is set as a function of is the kernel order. In our experi $n$ to minimize MSE, the boundnts, all aspects of our model $O ( n ^ { - \frac { 2 \beta } { 2 \beta + 1 } } )$ $\beta$ are fixed across training size when estimating one learning curve, except learning schedule, but it should be noted that error bounds and likely the learning curve parameters depend on both the classifier form and which parameters vary with $n$ .
# D.3 OTHER PLANNED IMPROVEMENTS
• Experiments to include WRN-28-10 (or similarly effective Wide ResNet model) on Cifar100 to show that learning curve methodology applies and experimental findings hold for high-performing models Discussion to clarify that experiments serve to exemplify use of learning curves and make interesting observations, but more extensive study of each design parameter is warranted. Also discuss any other concerns/limitations raised by reviewers.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358# NON-AUTOREGRESSIVE DIALOG STATE TRACKING
Hung Le‡∗, Richard Socher†, Steven C.H. Hoi† † Salesforce Research {rsocher,shoi}@salesforce.com $\ddagger$ Singapore Management University hungle.2018@phdcs.smu.edu.sg
# ABSTRACT
Recent efforts in Dialogue State Tracking (DST) for task-oriented dialogues have progressed toward open-vocabulary or generation-based approaches where the models can generate slot value candidates from the dialogue history itself. These approaches have shown good performance gain, especially in complicated dialogue domains with dynamic slot values. However, they fall short in two aspects: (1) they do not allow models to explicitly learn signals across domains and slots to detect potential dependencies among (domain, slot) pairs; and (2) existing models follow auto-regressive approaches which incur high time cost when the dialogue evolves over multiple domains and multiple turns. In this paper, we propose a novel framework of Non-Autoregressive Dialog State Tracking (NADST) which can factor in potential dependencies among domains and slots to optimize the models towards better prediction of dialogue states as a complete set rather than separate slots. In particular, the non-autoregressive nature of our method not only enables decoding in parallel to significantly reduce the latency of DST for realtime dialogue response generation, but also detect dependencies among slots at token level in addition to slot and domain level. Our empirical results show that our model achieves the state-of-the-art joint accuracy across all domains on the MultiWOZ 2.1 corpus, and the latency of our model is an order of magnitude lower than the previous state of the art as the dialogue history extends over time.
# 1 INTRODUCTION
In task-oriented dialogues, a dialogue agent is required to assist humans for one or many tasks such as finding a restaurant and booking a hotel. As a sample dialogue shown in Table 1, each user utterance typically contains important information identified as slots related to a dialogue domain such as attraction-area and train-day. A crucial part of a task-oriented dialogue system is Dialogue State Tracking (DST), which aims to identify user goals expressed during a conversation in the form of dialogue states. A dialogue state consists of a set of (slot, value) pairs e.g. (attraction-area, centre) and (train-day, tuesday). Existing DST models can be categorized into two types: fixed- and open-vocabulary. Fixed vocabulary models assume known slot ontology and generate a score for each candidate of (slot,value) (Ramadan et al., 2018; Lee et al., 2019). Recent approaches propose open-vocabulary models that can generate the candidates, especially for slots such as entity names and time, from the dialogue history (Lei et al., 2018; Wu et al., 2019).
Most open-vocabulary DST models rely on autoregressive encoders and decoders, which encode dialogue history sequentially and generate token $t _ { i }$ of individual slot value one by one conditioned on all previously generated tokens $t _ { [ 1 : i - 1 ] }$ . For downstream tasks of DST that emphasize on low latency (e.g. generating real-time dialogue responses), auto-regressive approaches incur expensive time cost as the ongoing dialogues become more complex. The time cost is caused by two major components: length of dialogue history i.e. number of turns, and length of slot values. For complex dialogues extended over many turns and multiple domains, the time cost will increase significantly in both encoding and decoding phases.
Similar problems can be seen in the field of Neural Machine Translation (NMT) research where a long piece of text is translated from one language to another. Recent work has tried to improve the latency in NMT by using neural network architectures such as convolution (Krizhevsky et al., 2012) and attention (Luong et al., 2015). Several non- and semi-autoregressive approaches aim to generate tokens of the target language independently (Gu et al., 2018; Lee et al., 2018; Kaiser et al., 2018). Motivated by this line of research, we thus propose a non-autoregressive approach to minimize the time cost of DST models without a negative impact on the model performance.
Table 1: A sample task-oriented dialogue with annotated dialogue states after each user turn. The dialogue states in red and blue denote slots from the attraction domain and train domain respectively. Slot values are expressed in user and system utterances (highlighted by underlined text).
<table><tr><td>Human: Dialog State:</td><td>i want to visit a theater in the center of town (attraction-area, centre), (attraction-type, theatre)</td></tr><tr><td>System: Human: Dialog State:</td><td>there are 4 matches.ido not have any info on the fees.do you have any other preferences ? no other preferences,i just want to be sure to get the phone number of whichever theatre we pick . (attraction-area, centre), (attraction-type, theatre)</td></tr><tr><td>System: Human: Dialog State:</td><td>irecommendthecambridgecorn exchangethere phone numberis O1223357851.isthere anything elseican helpyou with? yes,i am looking for a tuesday train. (attraction-area,centre),(atraction-name,thecambridgecor exchange),(attraction-type,theatre),(train-day,tuesday)</td></tr><tr><td>System: Human:</td><td>where will you be departing fromand what s your destination ? from cambridge to london liverpool street</td></tr><tr><td>Dialog State:</td><td>(atraction-area,centre),(atraction-name,thecambridgecon exchange),(attraction-type,theatre),(train-day,tuesday), (train-departure, cambridge), (train-destination, london liverpool street)</td></tr></table>
We adopt the concept of fertility proposed by Gu et al. (2018). Fertility denotes the number of times each input token is copied to form a sequence as the input to the decoder for non-autoregressive decoding. We first reconstruct dialogue state as a sequence of concatenated slot values. The result sequence contains the inherent structured representation in which we can apply the fertility concept. The structure is defined by the boundaries of individual slot values. These boundaries can be easily obtained from dialogue state itself by simply measuring number of the tokens of individual slots. Our model includes a two-stage decoding process: (1) the first decoder learns relevant signals from the input dialogue history and generates a fertility for each input slot representation; and (2) the predicted fertility is used to form a structured sequence which consists of multiple sub-sequences, each represented as (slot token $\times$ slot fertility). The result sequence is used as input to the second decoder to generate all the tokens of the target dialogue state at once.
In addition to being non-autoregressive, our models explicitly consider dependencies at both slot level and token level. Most of existing DST models assume independence among slots in dialogue states without explicitly considering potential signals across the slots (Wu et al., 2019; Lee et al., 2019; Goel et al., 2019; Gao et al., 2019). However, we hypothesize that it is not true in many cases. For example, a good DST model should detect the relation that train departure should not have the same value as train destination (example in Table 1). Other cases include time-related pairs such as (taxi arriveBy, taxi leaveAt) and cross-domain pairs such as (hotel area, attraction area). Our proposed approach considers all possible signals across all domains and slots to generate a dialogue state as a set. Our approach directly optimizes towards the DST evaluation metric Joint Accuracy (Henderson et al., 2014b), which measures accuracy at state (set of slots) level rather than slot level.
Our contributions in this work include: (1) we propose a novel framework of Non-Autoregressive Dialog State Tracking (NADST), which explicitly learns inter-dependencies across slots for decoding dialogue states as a complete set rather than individual slots; (2) we propose a non-autoregressive decoding scheme, which not only enjoys low latency for real-time dialogues, but also allows to capture dependencies at token level in addition to slot level; (3) we achieve the state-of-the-art performance on the multi-domain task-oriented dialogue dataset “MultiWOZ 2.1” (Budzianowski et al., 2018; Eric et al., 2019) while significantly reducing the inference latency by an order of magnitude; (4) we conduct extensive ablation studies in which our analysis reveals that our models can detect potential signals across slots and dialogue domains to generate more correct “sets” of slots for DST.
# 2 RELATED WORK
Our work is related to two research areas: dialogue state tracking and non-autoregressive decoding.
# 2.1 DIALOGUE STATE TRACKING
Dialogue State Tracking (DST) is an important component in task-oriented dialogues, especially for dialogues with complex domains that require fine-grained tracking of relevant slots. Traditionally,
DST is coupled with Natural Language Understanding (NLU). NLU output as tagged user utterances is input to DST models to update the dialogue states turn by turn (Kurata et al., 2016; Shi et al., 2016; Rastogi et al., 2017). Recent approaches combine NLU and DST to reduce the credit assignment problem and remove the need for NLU (Mrksiˇ c et al., 2017; Xu & Hu, 2018; Zhong et al., 2018). ´ Within this body of research, Goel et al. (2019) differentiates two DST approaches: fixed- and openvocabulary. Fixed-vocabulary approaches are usually retrieval-based methods in which all candidate pairs of (slot, value) from a given slot ontology are considered and the models predict a probability score for each pair (Henderson et al., 2014c; Ramadan et al., 2018; Lee et al., 2019). Recent work has moved towards open-vocabulary approaches that can generate the candidates based on input text i.e. dialogue history (Lei et al., 2018; Gao et al., 2019; Wu et al., 2019). Our work is more related to these models, but different from most of the current work, we explicitly consider dependencies among slots and domains to decode dialogue state as a complete set.
# 2.2 NON-AUTOREGRESSIVE DECODING
Most of prior work in non- or semi-autoregressive decoding methods are used for NMT to address the need for fast translation. Schwenk (2012) proposes to estimate the translation model probabilities of a phase-based NMT system. Libovicky & Helcl (2018) formulates the decoding process as \` a sequence labeling task by projecting source sequence into a longer sequence and applying CTC loss (Graves et al., 2006) to decode the target sequence. Wang et al. (2019) adds regularization terms to NAT models (Gu et al., 2018) to reduce translation errors such as repeated tokens and incomplete sentences. Ghazvininejad et al. (2019) uses a non-autoregressive decoder with masked attention to decode target sequences over multiple generation rounds. A common challenge in nonautoregressive NMT is the large number of sequential latent variables, e.g., fertility sequences (Gu et al., 2018) and projected target sequences (Libovicky & Helcl, 2018). These latent variables are \` used as supporting signals for non- or semi-autoregressive decoding. We reformulate dialogue state as a structured sequence with sub-sequences defined as a concatenation of slot values. This form of dialogue state can be inferred easily from the dialogue state annotation itself whereas such supervision information is not directly available in NMT. The lower semantic complexity of slot values as compared to long sentences in NMT makes it easier to adopt non-autoregressive approaches into DST. According to our review, we are the first to apply a non-autoregressive framework for generation-based DST. Our approach allows joint state tracking across slots, which results in better performance and an order of magnitude lower latency during inference.
# 3 APPROACH
Our NADST model is composed of three parts: encoders, fertility decoder, and state decoder, as shown in Figure 1. The input includes the dialogue history $\boldsymbol { X } = ( x _ { 1 } , . . . , x _ { N } )$ and a sequence of applicable (domain, slot) pairs $X _ { \mathrm { d s } } = ( ( d _ { 1 } , s _ { 1 } ) , . . . , ( d _ { G } , s _ { H } ) )$ , where $G$ and $H$ are the total numbers of domains and slots, respectively. The output is the corresponding dialogue states up to the current dialogue history. Conventionally, the output of dialogue state is denoted as tuple (slot, value) (or (domain-slot, value) for multi-domain dialogues). We reformulate the output as a concatenation of slot values $Y ^ { d _ { i } , s _ { j } } \colon Y = ( Y ^ { d _ { 1 } , s _ { 1 } } , . . . , Y ^ { d _ { I } , s _ { J } } ) = ( y _ { 1 } ^ { d _ { 1 } , s _ { 1 } } , y _ { 2 } ^ { d _ { 1 } , s _ { 1 } } , . . . , y _ { 1 } ^ { d _ { I } , s _ { J } } , y _ { 2 } ^ { d _ { I } , s _ { J } } , . . . )$ where $I$ and $J$ are the numbers of domains and slots in the output dialogue state, respectively.
First, the encoders use token-level embedding and positional encoding to encode the input dialogue history and (domain, slot) pairs into continuous representations. The encoded domains and slots are then input to stacked self-attention and feed-forward network to obtain relevant signals across dialogue history and generate a fertility $Y _ { f } ^ { d _ { g } , s _ { h } }$ for each (domain, slot) pair $\left( d _ { g } , s _ { h } \right)$ . The output of fertility decoder is defined as a sequence: Yfert = Y d1,s1f , $Y _ { \mathrm { f e r t } } = Y _ { f } ^ { d _ { 1 } , s _ { 1 } } , . . . , Y _ { f } ^ { d _ { G } , s _ { H } }$ where $Y _ { f } ^ { d _ { g } , d _ { h } } \in$ $\{ 0 , \mathrm { { m a x } ( \mathrm { { S l o t L e n g t h } ) } } \}$ . For example, for the MultiWOZ dataset in our experiments, we have $\mathrm { { m a x } ( S l o t L e n g t h ) = 9 }$ according to the training data. We follow (Wu et al., 2019; Gao et al., 2019) to add a slot gating mechanism as an auxiliary prediction. Each gate $g$ is restricted to 3 possible values: “none”, “dontcare” and “generate”. They are used to form higher-level classification signals to support fertility decoding process. The gate output is defined as a sequence: $Y _ { \mathrm { g a t e } } = Y _ { g } ^ { d _ { 1 } , s _ { 1 } } , . . . , Y _ { g } ^ { d _ { G } , s _ { H } }$ .
The predicted fertilities are used to form an input sequence to the state decoder for nonautoregressive decoding. The sequence includes sub-sequences of $( d _ { g } , s _ { h } )$ repeated by $Y _ { f } ^ { d _ { g } , s _ { h } }$ times and concatenated sequentially: Xds×fert = ((d1, s1)Y d1,s1f , $X _ { \mathrm { d s } \times \mathrm { f e r t } } = ( ( d _ { 1 } , s _ { 1 } ) ^ { Y _ { f } ^ { d _ { 1 } , s _ { 1 } } } , . . . , ( d _ { G } , s _ { H } ) ^ { Y _ { f } ^ { d _ { G } , s _ { H } } } )$ and $\| X _ { \mathrm { d s } \times \mathrm { f e r t } } \| =$ $\| Y \|$ . The decoder projects this sequence through attention layers with dialogue history. During this decoding process, we maintain a memory of hidden states of dialogue history. The output from the state decoder is used as a query to attend on this memory and copy tokens from the dialogue history to generate a dialogue state.
Following Lei et al. (2018), we incorporate information from previous dialogue turns to predict current turn state by using a partially delexicalized dialogue history $X _ { \mathrm { d e l } } = ( x _ { 1 , \mathrm { d e l } } , . . . , x _ { N , \mathrm { d e l } } )$ as an input of the model. The dialogue history is delexicalized till the last system utterance by removing real-value tokens that match the previously decoded slot values to tokens expressed as domain-slot. Given a token $x _ { n }$ and the current dialogue turn $t$ , the token is delexicalized as follows:
$$\begin{array} { r l } & { x _ { n , \mathrm { d e l } } = \mathrm { d e l e x } ( x _ { n } ) = \left\{ \begin{array} { l l } { \mathrm { d o m a i n } _ { \mathrm { i d x } } \mathrm { - s l o t } _ { \mathrm { i d x } } , } & { \mathrm { i f ~ } x _ { n } \subset \hat { Y } _ { t - 1 } . } \\ { x _ { n } , } & { \mathrm { o t h e r w i s e } . } \end{array} \right. } \\ & { \mathrm { l o m a i n } _ { \mathrm { i d x } } = X _ { \mathrm { d s } \times \mathrm { f e r t } } [ \mathrm { i d x } ] [ 0 ] , \quad \mathrm { s l o t } _ { \mathrm { i d x } } = X _ { \mathrm { d s } \times \mathrm { f e r t } } [ \mathrm { i d x } ] [ 1 ] , \quad \mathrm { i d x } = \mathrm { I n d e x } ( x _ { n } , \hat { Y } _ { t - 1 } ) } \end{array}$$
For example, the user utterance “I look for a cheap hotel” is delexicalized to $^ { 6 6 } \mathrm { I }$ look for a hotel pricerange hotel.” if the slot hotel pricerange is predicted as “cheap” in the previous turn. This approach makes use of the delexicalized form of dialogue history while not relying on an NLU module as we utilize the predicted state from DST model itself. In addition to the belief state, we also use the system action in the previous turn to delexicalize the dialog history in a similar manner, following prior work (Rastogi et al., 2017; Zhong et al., 2018; Goel et al., 2019).
 Figure 1: Our NADST has 3 key components: encoders (“red”), fertility decoder (“blue”), and state decoder (“green”). (i) Encoders encode sequences of dialogue history, delexicalized dialogue history, and domain and slot tokens into continuous representations; (ii) Fertility Decoder has 3 attention mechanisms to learn potential dependencies across (domain, slot) pairs in combination with dialogue history. The output is used to generate fertilities and slot gates; and (iii) State Decoder receives the input sequence including sub-sequences of (domain, slot) $^ { 1 \times }$ fertility to decode a complete dialogue state sequence as concatenation of component slot values. For simplicity, we do not show feedforward, residual connection, and layer-normalization layers in the figure. Best viewed in color.
# 3.1 ENCODERS
An encoder is used to embed dialogue history $X$ into a sequence of continuous representations $Z = ( z _ { 1 } , . . . , z _ { N } ) \in \mathbb { R } ^ { N \times d }$ . Similarly, partially delexicalized dialogue history $X _ { d e l }$ is encoded to continuous representations $Z _ { \mathrm { d e l } } \in \dot { \mathbb { R } } ^ { N \times d }$ . We store the encoded dialogue history $Z$ in memory which will be passed to a pointer network to copy words for dialogue state generation. This helps to address the OOV challenge as shown in (See et al., 2017; Wu et al., 2019). We also encode each (domain, slot) pair into continuous representation $z _ { \mathrm { d s } } \in \mathbb { R } ^ { d }$ as input to the decoders. Each vector $z _ { \mathrm { d s } }$ is used to store contextual signals for slot and fertility prediction during the decoding process.
Context Encoder. Context encoder includes a token-level trainable embedding layer and layer normalization (Ba et al., 2016). The encoder also includes a positional encoding layer which follows sine and cosine functions (Vaswani et al., 2017). An element-wise summation is used to combine the token-level vectors with positional encoded vectors. We share the embedding weights to embed the raw and delexicalized dialogue history. The embedding weights are also shared to encode input to both fertility decoder and state decoder. The final embedding of $X$ and $X _ { d e l }$ is defined as:
$$\begin{array} { c } { Z = Z _ { \mathrm { e m b } } + \mathrm { P E } ( X ) \in \mathbb { R } ^ { N \times d } } \\ { Z _ { \mathrm { d e l } } = Z _ { \mathrm { e m b , d e l } } + \mathrm { P E } ( X _ { \mathrm { d e l } } ) \in \mathbb { R } ^ { N \times d } } \end{array}$$
Domain and Slot Encoder. Each (domain, slot) pair is encoded by using two separate embedding vectors of the corresponding domain and slot. Each domain $g$ and slot $h$ is embedded into a continuous representation $z _ { d _ { g } }$ and $\boldsymbol { z } _ { s _ { h } } \in \mathbb { R } ^ { d }$ . The final vector is combined by element-wise summation:
$$z _ { d _ { g } , s _ { h } } = z _ { d _ { g } } + z _ { s _ { h } } \in \mathbb { R } ^ { d }$$
We share the embedding weights to embed domain and slot tokens in both fertility decoder and state decoder. However, for input to state decoder, we inject sequential information into the input $X _ { \mathrm { d s \times f e r t } }$ to factor in position-wise information to decode target state sequence. In summary, $X _ { \mathrm { d s } }$ and $X _ { \mathrm { d s \times f e r t } }$ is encoded as following:
$$\begin{array} { c } { { Z _ { \mathrm { d s } } = Z _ { \mathrm { e m b , d s } } = z _ { d _ { 1 } , s _ { 1 } } \oplus . . . \oplus z _ { d _ { G } , s _ { H } } } } \\ { { Z _ { \mathrm { d s } \times \mathrm { f e r t } } = Z _ { \mathrm { e m b , d s } \times \mathrm { f e r t } } + \mathrm { P E } ( X _ { \mathrm { d s } \times \mathrm { f e r t } } ) } } \\ { { Z _ { \mathrm { e m b , d s } \times \mathrm { f e r t } } = ( z _ { d _ { 1 } , s _ { 1 } } ) ^ { Y _ { f } ^ { d _ { 1 } , s _ { 1 } } } \oplus . . . \oplus ( z _ { d _ { G } , s _ { H } } ) ^ { Y _ { f } ^ { d _ { G } , s _ { H } } } } } \end{array}$$
where $\oplus$ denotes concatenation operation. Note that different from a typical decoder input in Transformer, we do not shift the input sequences to both fertility decoder and state decoder by one position as we consider non-autoregressive decoding process in both modules. Therefore, all output tokens are generated in position $i$ based on all remaining positions of the sequence i.e. $1 , . . . , i - 1 , i + 1 , . . . \| \bar { X } _ { \mathrm { d s } } \|$ in fertility decoder and $1 , . . . , i - 1 , i + 1 , . . . \| X _ { \mathrm { d s } \times \mathrm { f e r t } } \|$ in state decoder.
# 3.2 FERTILITY DECODER
Given the encoded dialogue history $Z$ , delexicalized dialogue history $Z _ { \mathrm { d e l } }$ , and (domain,slot) pairs $Z _ { \mathrm { d s } }$ , the contextual signals are learned and passed into each $z _ { \mathrm { d s } }$ vector through a sequence of attention layers. We adopt the multi-head attention mechanism (Vaswani et al., 2017) to project the representations into multiple sub-spaces. The attention mechanism is defined as scaled dot-product attention between query $Q$ , key $K$ , and value $V$ :
$$\mathrm { A t t e n t i o n } ( Q , K , V ) = \mathrm { s o f t m a x } ( \frac { Q K ^ { T } } { \sqrt { d _ { k } } } V )$$
Each multi-head attention is followed by a position-wise feed-forward network. The feed-forward is applied to each position separately and identically. We use two linear layers with a ReLU activation in between. The fertility decoder consists of 3 attention layers, each of which learns relevant contextual signals and incorporates them into $z _ { d s }$ vectors as input to the next attention layer:
$$\begin{array} { r l } & { Z _ { \mathrm { d s } } ^ { \mathrm { o u t } } = \mathrm { A t t e n t i o n } ( Z _ { \mathrm { d s } } , Z _ { \mathrm { d s } } , Z _ { \mathrm { d s } } ) \in \mathbb { R } ^ { N \times d } } \\ & { Z _ { \mathrm { d s } } ^ { \mathrm { o u t } } = \mathrm { A t t e n t i o n } ( Z _ { \mathrm { d s } } ^ { \mathrm { o u t } } , Z _ { \mathrm { d e l } } , Z _ { \mathrm { d e l } } ) \in \mathbb { R } ^ { N \times d } } \\ & { Z _ { \mathrm { d s } } ^ { \mathrm { o u t } } = \mathrm { A t t e n t i o n } ( Z _ { \mathrm { d s } } ^ { \mathrm { o u t } } , Z , Z ) \in \mathbb { R } ^ { N \times d } } \end{array}$$
For simplicity, we do not express the multi-head and feed-forward equations. We advise the reader to review Transformer network (Vaswani et al., 2017) for more detailed description. The multi-head structure has shown to obtain good performance in many NLP tasks such as NMT (Vaswani et al., 2017) and QA (Dehghani et al., 2019). By adopting this attention mechanism, we allow the models to explicitly obtain signals of potential dependencies across (domain, slot) pairs in the first attention layer, and contextual dependencies in the subsequent attention layers. Adding the delexicalized dialogue history as input can provide important contextual signals as the models can learn the mapping between real-value tokens and generalized domain-slot tokens. To further improve the model capability to capture these dependencies, we repeat the attention sequence for $T _ { \mathrm { f e r t } }$ times with $Z _ { \mathrm { d s } }$ . In an attentionto compute . $t$ , the output from the previous attentio The output in the last attention layer $t - 1$ is used as input to current layerssed to two independent linear $Z _ { \mathrm { d s } } ^ { t }$ $Z _ { \mathrm { d s } } ^ { \mathrm { T _ { f e r t } } }$ transformations to predict fertilities and gates:
$$\begin{array} { r } { P ^ { \mathrm { g a t e } } = \mathrm { s o f t m a x } ( W _ { \mathrm { g a t e } } Z _ { \mathrm { d s } } ^ { T _ { \mathrm { f e r t } } } ) } \\ { P ^ { \mathrm { f e r t } } = \mathrm { s o f t m a x } ( W _ { \mathrm { f e r t } } Z _ { \mathrm { d s } } ^ { T _ { \mathrm { f e r t } } } ) } \end{array}$$
where $W _ { \mathrm { g a t e } } ~ \in ~ \mathbb { R } ^ { d \times 3 }$ and $W _ { \mathrm { f e r t } } ~ \in ~ \mathbb { R } ^ { d \times 1 0 }$ . We use the standard cross-entropy loss to train the prediction of gates and fertilities:
$$\begin{array} { r l } & { \mathcal { L } _ { \mathrm { g a t e } } = \displaystyle \sum _ { d _ { g } , s _ { h } } - \log ( P ^ { \mathrm { g a t e } } ( Y _ { g } ^ { d _ { g } , s _ { h } } ) ) } \\ & { \mathcal { L } _ { \mathrm { f e r t } } = \displaystyle \sum _ { d _ { g } , s _ { h } } - \log ( P ^ { \mathrm { f e r t } } ( Y _ { f } ^ { d _ { g } , s _ { h } } ) ) } \end{array}$$
# 3.3 STATE DECODER
Given the generated gates and fertilities, we form the input sequence $X _ { \mathrm { d s \times f e r t } }$ . We filter out any (domain, slot) pairs that have gate either as “none” or “dontcare”. Given the encoded input $Z _ { \mathrm { d s \times f e r t } }$ , we apply a similar attention sequence as used in the fertility decoder to incorporate contextual signals into each ${ \mathcal { Z } } _ { \mathrm { d s } \times \mathrm { f e r t } }$ vector. The dependencies are captured at the token level in this decoding stage rather than at domain/slot higher level as in the fertility decoder. After repeating the attention sequence for $T _ { \mathrm { s t a t e } }$ times, the final output $Z _ { \mathrm { d s } \times \mathrm { f e r t } } ^ { T _ { \mathrm { s t a t e } } }$ is used to predict the state in the following:
$$P _ { \mathrm { v o c a b } } ^ { \mathrm { s t a t e } } = \mathrm { s o f t m a x } ( W _ { \mathrm { s t a t e } } Z _ { \mathrm { d s } \times \mathrm { f e r t } } ^ { T _ { \mathrm { s t a t e } } } )$$
where $W _ { s t a t e } \in \mathbb { R } ^ { d \times \lVert V \rVert }$ with $V$ as the set of output vocabulary. As open-vocabulary DST models do not assume a known slot ontology, our models can generate the candidates from the dialogue history itself. To address OOV problem during inference, we incorporate a pointer network (Vinyals et al., 2015) into the Transformer decoder. We apply dot-product attention between the state decoder output and the stored memory of encoded dialogue history $Z$ :
$$P _ { \mathrm { p t r } } ^ { \mathrm { s t a t e } } = \mathrm { s o f t m a x } ( Z _ { \mathrm { d s } \times \mathrm { f e r t } } ^ { T _ { \mathrm { s t a t e } } } Z ^ { T } )$$
he final probability of predicted state is defined as the weighted sum of the two probabilities:
$$\begin{array} { r l } & { P ^ { \mathrm { s t a t e } } = p _ { \mathrm { g e n } } ^ { \mathrm { s t a t e } } \times P _ { \mathrm { v o c a b } } ^ { \mathrm { s t a t e } } + ( 1 - p _ { \mathrm { g e n } } ^ { \mathrm { s t a t e } } ) \times P _ { \mathrm { p t r } } ^ { \mathrm { s t a t e } } } \\ & { p _ { \mathrm { g e n } } ^ { \mathrm { s t a t e } } = \mathrm { s i g m o i d } ( W _ { \mathrm { g e n } } V _ { \mathrm { g e n } } ) } \\ & { V _ { \mathrm { g e n } } = Z _ { \mathrm { d s } \times \mathrm { f e r t } } \oplus Z _ { \mathrm { d s } \times \mathrm { f e r t } } ^ { T _ { \mathrm { s t a t e } } } \oplus Z _ { \mathrm { e x p } } } \end{array}$$
where $W _ { \mathrm { g e n } } \in \mathbb { R } ^ { 3 d \times 1 }$ and $Z _ { \mathrm { e x p } }$ is the expanded vector of $Z$ to match dimensions of $Z _ { \mathrm { d s \times f e r t } }$ . The final probability is used to train the state generation following the cross-entropy loss function:
$$\mathcal { L } _ { \mathrm { s t a t e } } = \sum _ { d _ { g } , s _ { h } } \sum _ { m = 0 } ^ { Y _ { f } ^ { d _ { g } , s _ { h } } } - \log ( P ^ { \mathrm { s t a t e } } ( y _ { m } ^ { d _ { g } , s _ { h } } ) )$$
# 3.4 OPTIMIZATION
We optimize all parameters by jointly training to minimize the weighted sum of the three losses:
$$\mathcal { L } = \mathcal { L } _ { \mathrm { s t a t e } } + \alpha \mathcal { L } _ { \mathrm { g a t e } } + \beta \mathcal { L } _ { \mathrm { f e r t } }$$
where $\alpha \geq 0$ and $\beta \geq 0$ are hyper-parameters.
# 4 EXPERIMENTS
# 4.1 DATASET
MultiWOZ (Budzianowski et al., 2018) is one of the largest publicly available multi-domain taskoriented dialogue dataset with dialogue domains extended over 7 domains. In this paper, we use the new version of the MultiWOZ dataset published by Eric et al. (2019). The new version includes some correction on dialogue state annotation with more than $40 \%$ change across dialogue turns. On average, each dialogue has more than one domain. We pre-processed the dialogues by tokenizing, lower-casing, and delexicalizing all system responses following the pre-processing scripts from (Wu et al., 2019). We identify a total of 35 (domain, slot) pairs. Other details of data pre-processing procedures, corpus statistics, and list of (domain, slot) pairs are described in Appendix A.1.
# 4.2 TRAINING PROCEDURE
We use label smoothing (Szegedy et al., 2016) to train the prediction of dialogue state $Y$ but not for prediction of fertilities $Y _ { \mathrm { f e r t } }$ and gates $Y _ { \mathrm { g a t e } }$ . During training, we adopt $100 \%$ teacher-forcing learning strategy by using the ground-truth of $X _ { \mathrm { d s \times f e r t } }$ as input to the state decoder. We also apply the same strategy to obtain delexicalized dialogue history i.e. dialogue history is delexicalized from the ground-truth belief state in previous dialogue turn rather than relying on the predicted belief state. During inference, we follow a similar strategy as (Lei et al., 2018) by generating dialogue state turn-by-turn and use the predicted belief state in turn $t - 1$ to delexicalize dialogue history in turn $t$ . During inference, $X _ { \mathrm { d s } \times \mathrm { f e r t } }$ is also constructed by prediction $\hat { Y } _ { \mathrm { g a t e } }$ and $\hat { Y } _ { \mathrm { f e r t } }$ . We adopt the Adam optimizer (Kingma & Ba, 2015) and the learning rate strategy similarly as (Vaswani et al., 2017). Best models are selected based on the best average joint accuracy of dialogue state prediction in the validation set. All parameters are randomly initialized with uniform distribution (Glorot & Bengio, 2010). We did not utilize any pretrained word- or character-based embedding weights. We tuned the hyper-parameters with grid-search over the validation set (Refer to Appendix A.2 for further details). We implemented our models using PyTorch (Paszke et al., 2017) and released the code on GitHub 1.
# 4.3 BASELINES
The DST baselines can be divided into 2 groups: open-vocabulary approach and fixed-vocabulary approach as mentioned in Section 2. Fixed-vocabulary has the advantage of access to the known candidate set of each slot and has a high performance of prediction within this candidate set. However, during inference, the approach suffers from unseen slot values for slots with evolving candidates such as entity names and time- and location-related slots.
# 4.3.1 FIXED-VOCABULARY
GLAD (Zhong et al., 2018). GLAD uses multiple self-attentive RNNs to learn a global tracker for shared parameters among slots and a local tracker for individual slot. The model utilizes previous system actions as input. The output is used to compute semantic similarity with ontology terms.
GCE (Nouri & Hosseini-Asl, 2018). GCE is a simplified and faster version of GLAD. The model removes slot-specific RNNs while maintaining competitive DST performance.
MDBT (Ramadan et al., 2018). MDBT model includes separate encoding modules for system utterances, user utterances, and (slot, value) pairs. Similar to GLAD, The model is trained based on the semantic similarity between utterances and ontology terms.
FJST and HJST (Eric et al., 2019). FJST refers to Flat Joint State Tracker, which consists of a dialog history encoder as a bidirectional LSTM network. The model also includes separate feedforward networks to encode hidden states of individual state slots. HJST follows a similar architecture but uses a hierarchical LSTM network (Serban et al., 2016) to encode the dialogue history.
SUMBT (Lee et al., 2019). SUMBT refers to Slot-independent Belief Tracker, consisting of a multi-head attention layer with query vector as a representation of a (domain, slot) pair and key and value vector as BERT-encoded dialogue history. The model follows a non-parametric approach as it is trained to minimize a score such as Euclidean distance between predicted and target slots. Our approach is different from SUMBT as we include attention among (domain, slot) pairs to explicitly learn dependencies among the pairs. Our models also generate slot values rather than relying on a fixed candidate set.
# 4.3.2 OPEN-VOCABULARY
TSCP (Lei et al., 2018). TSCP is an end-to-end dialogue model consisting of an RNN encoder and two RNN decoder with a pointer network. We choose this as a baseline because TSCP decodes dialogue state as a single sequence and hence, factor in potential dependencies among slots like our work. We adapt TSCP into multi-domain dialogues and report the performance of only the DST component rather than the end-to-end model. We also reported the performance of TSCP for two cases when the maximum length of dialogue state sequence $L$ in the state decoder is set to 8 or 20 tokens. Different from TSCP, our models dynamically learn the length of each state sequence as the sum of predicted fertilities and hence, do not rely on a fixed value of $L$ .
DST Reader (Gao et al., 2019). DST Reader reformulates the DST task as a reading comprehension task. The prediction of each slot is a span over tokens within the dialogue history. The model follows an attention-based neural network architecture and combines a slot carryover prediction module and slot type prediction module.
HyST (Goel et al., 2019). HyST model combines both fixed-vocabulary and open-vocabulary approach by separately choosing which approach is more suitable for each slot. For the openvocabulary approach, the slot candidates are formed as sets of all word n-grams in the dialogue history. The model makes use of encoder modules to encode user utterances and dialogue acts to represent the dialogue context.
TRADE (Wu et al., 2019). This is the current state-of-the-art model on the MultiWOZ2.0 and 2.1 datasets. TRADE is composed of a dialog history encoder, a slot gating module, and an RNN decoder with a pointer network for state generation. SpanPtr is a related baseline to TRADE as reported by Wu et al. (2019). The model makes use of a pointer network with index-based copying instead of a token-based copying mechanism.
# 4.4 RESULTS
We evaluate model performance by the joint goal accuracy as commonly used in DST (Henderson et al., 2014b). The metric compares the predicted dialogue states to the ground truth in each dialogue turn. A prediction is only correct if all the predicted values of all slots exactly match the corresponding ground truth labels. We ran our models for 5 times and reported the average results. For completion, we reported the results in both MultiWOZ 2.0 and 2.1.
As can be seen in Table 2, although our models are designed for non-autoregressive decoding, they can outperform state-of-the-art DST approaches that utilize autoregressive decoding such as (Wu et al., 2019). Our performance gain can be attributed to the model capability of learning crossdomain and cross-slot signals, directly optimizing towards the evaluation metric of joint goal accuracy rather than just the accuracy of individual slots. Following prior DST work, we reported the model performance on the restaurant domain in MultiWOZ 2.0 in Table 4. In this dialogue domain, our model surpasses other DST models in both Joint Accuracy and Slot Accuracy. Refer to Appendix A.3 for our model performance in other domains in both MultiWOZ2.0 and MultiWOZ2.1.
Latency Analysis. We reported the latency results in term of wall-clock time (in ms) per prediction state of our models and the two baselines TRADE (Wu et al., 2019) and TSCP (Lei et al., 2018) in Table 4. For TSCP, we reported the time cost only for the DST component instead of the end-toend models. We conducted experiments with 2 cases of TSCP when the maximum output length of dialogue state sequence in the state decoder is set as $L = 8$ and $L = 2 0$ . We varied our models for different values of $T = T _ { \mathrm { f e r t } } = T _ { \mathrm { s t a t e } } \in \{ 1 , 2 , 3 \}$ . All latency results are reported when running in a single identical GPU. As can be seen in Table 4, NADST obtains the best performance when $T = 3$ . The model outperforms the baselines while taking much less time during inference. Our approach is similar to TSCP which also decodes a complete dialogue state sequence rather than individual slots to factor in dependencies among slot values. However, as TSCP models involve sequential processing in both encoding and decoding, they require much higher latency. TRADE shortens the latency by separating the decoding process among (domain, slot) pairs. However, at the token level, TRADE models follow an auto-regressive process to decode individual slots and hence, result in higher average latency as compared to our approach. In NADST, the model latency is only affected by the number of attention layers in fertility decoder $T _ { \mathrm { f e r t } }$ and state decoder $T _ { \mathrm { s t a t e } }$ . For approaches with sequential encoding and/or decoding such as TSCP and TRADE, the latency is affected by the length of source sequences (dialog history) and target sequence (dialog state). Refer to Appendix A.3 for visualization of model latency in terms of dialogue history length.
<table><tr><td>Model</td><td>MultiWOZ2.1</td><td>MultiWOZ2.0</td></tr><tr><td>MDBT (Ramadan et al., 2018) †</td><td></td><td>15.57%</td></tr><tr><td>SpanPtr (Vinyals et al., 2015)</td><td></td><td>30.28%</td></tr><tr><td>GLAD (Zhong et al., 2018) +</td><td></td><td>35.57%</td></tr><tr><td>GCE (Nouri & Hosseini-Asl, 2018) +</td><td></td><td>36.27%</td></tr><tr><td>HJST (Eric et al., 2019) *</td><td>35.55%</td><td>38.40%</td></tr><tr><td>DST Reader (single) (Gao et al., 2019) *</td><td>36.40%</td><td>39.41%</td></tr><tr><td>DST Reader (ensemble) (Gao et al.,2019)</td><td>1</td><td>42.12%</td></tr><tr><td>TSCP (Lei et al., 2018)</td><td>37.12%</td><td>39.24%</td></tr><tr><td>FJST (Eric et al., 2019) *</td><td>38.00%</td><td>40.20%</td></tr><tr><td>HyST (ensemble) (Goel et al., 2019) *</td><td>38.10%</td><td>44.24%</td></tr><tr><td>SUMBT (Lee et al., 2019) +</td><td>=</td><td>46.65%</td></tr><tr><td>TRADE (Wu et al., 2019) *</td><td>45.60%</td><td>48.60%</td></tr><tr><td>Ours</td><td>49.04%</td><td>50.52%</td></tr></table>
Table 2: DST Joint Accuracy metric on MultiWOZ 2.1 and 2.0. †: results reported on MultiWOZ2.0 leaderboard. ?: results reported by Eric et al. (2019). Best results are highlighted in bold.
Table 3: DST joint accuracy and slot accuracy on MultiWOZ2.0 restaurant domain. Baseline results (except TSCP) were from $\mathrm { W u }$ et al. (2019).
<table><tr><td>Model</td><td>Joint Acc</td><td>Slot Acc</td></tr><tr><td>MDBT</td><td>17.98%</td><td>54.99%</td></tr><tr><td>SPanPtr</td><td>49.12%</td><td>87.89%</td></tr><tr><td>GLAD</td><td>53.23%</td><td>96.54%</td></tr><tr><td>GCE</td><td>60.93%</td><td>95.85%</td></tr><tr><td>TSCP</td><td>62.01%</td><td>97.32%</td></tr><tr><td>TRADE</td><td>65.35%</td><td>93.28%</td></tr><tr><td>Ours</td><td>69.21%</td><td>98.84%</td></tr></table>
<table><tr><td>Model</td><td>Joint Acc Latency</td><td> Speed Up</td></tr><tr><td>TRADE 45.60%</td><td>362.15</td><td>×2.12</td></tr><tr><td>TSCP (L=8) 32.15%</td><td>493.44</td><td>×1.56</td></tr><tr><td>TSCP (L=20) 37.12%</td><td>767.57</td><td>×1.00</td></tr><tr><td>Ours (T=1) 42.98%</td><td>15.18</td><td>×50.56</td></tr><tr><td>Ours (T=2) 45.78%</td><td>21.67</td><td>×35.42</td></tr><tr><td>Ours (T=3) 49.04%</td><td>27.31</td><td>×28.11</td></tr></table>
Table 4: Latency analysis on MultiWOZ2.1. Latency is reported in terms of wall-clock time in ms per prediction state.
Ablation Analysis. We conduct an extensive ablation analysis with several variants of our models in Table 5. Besides the results of DST metrics, Joint Slot Accuracy and Slot Accuracy, we reported the performance of the fertility decoder in Joint Gate Accuracy and Joint Fertility Accuracy. These metrics are computed similarly as Joint Slot Accuracy in which the metrics are based on whether all predictions of gates or fertilities match the corresponding ground truth labels. We also reported the Oracle Joint Slot Accuracy and Slot Accuracy when the models are fed with ground truth $X _ { \mathrm { d s \times f e r t } }$ and $X _ { \mathrm { d e l } }$ labels instead of the model predictions. We noted that the model fails when positional encoding of $X _ { \mathrm { d s \times f e r t } }$ is removed before being passed to the state decoder. The performance drop can be explained because $P E$ is responsible for injecting sequential attributes to enable non-autoregressive decoding. Second, we also note a slight drop of performance when slot gating is removed as the models have to learn to predict a fertility of 1 for “none” and “dontcare” slots as well. Third, removing $X _ { \mathrm { d e l } }$ as an input reduces the model performance, mostly due to the sharp decrease in Joint Fertility Accuracy. Lastly, removing pointer generation and relying on only $P _ { \mathrm { v o c a b } } ^ { \mathrm { s t a t e } }$ affects the model performance as the models are not able to infer slot values unseen during training, especially for slots such as restaurant-name and train-arriveby. We conduct other ablation experiments and report additional results in Appendix A.3.
<table><tr><td>Xdel</td><td>Slot Gating</td><td>PE(Xdsxfert)</td><td>Pointer Gen.</td><td>Joint Gate Acc</td><td>Joint Fert. Acc</td><td>Joint Slot Acc</td><td>Slot Acc</td><td>Oracle Joint Slot Acc</td><td>Oracle Slot Acc</td></tr><tr><td>√</td><td>√</td><td>√</td><td>√</td><td>66.65%</td><td>63.18%</td><td>49.04%</td><td>97.31%</td><td>73.44%</td><td>99.01%</td></tr><tr><td>√</td><td>√</td><td></td><td>√</td><td>59.23%</td><td>57.83%</td><td>19.56%</td><td>94.36%</td><td>72.12%</td><td>98.96%</td></tr><tr><td>√</td><td></td><td>√</td><td>√</td><td>N/A</td><td>64.23%</td><td>48.74%</td><td>96.62%</td><td>73.01%</td><td>98.97%</td></tr><tr><td></td><td>√</td><td></td><td>√</td><td>48.23%</td><td>45.35%</td><td>39.45%</td><td>95.92%</td><td>66.27%</td><td>98.63%</td></tr><tr><td>√(no sys. act)</td><td>√</td><td>√</td><td>√</td><td>52.45%</td><td>56.81%</td><td>44.87%</td><td>96.95%</td><td>70.83%</td><td>98.74%</td></tr><tr><td></td><td>√</td><td>√</td><td></td><td>63.19%</td><td>58.31%</td><td>43.46%</td><td>96.72%</td><td>64.37%</td><td>98.39%</td></tr><tr><td></td><td>√</td><td>√</td><td></td><td>44.22%</td><td>42.01%</td><td>34.48%</td><td>95.89%</td><td>61.32%</td><td>98.24%</td></tr><tr><td></td><td></td><td>√</td><td></td><td>N/A</td><td>41.35%</td><td>33.52%</td><td>95.42%</td><td>60.99%</td><td>98.19%</td></tr></table>
Table 5: Ablation analysis on MultiWOZ 2.1 on 4 components: partially delexicalized dialogue history $X _ { d e l }$ , slot gating, positional encoding $P E ( X _ { d s \times f e r t } )$ , and pointer network.
Auto-regressive DST. We conduct experiments that use an auto-regressive state decoder and keep other parts of the model the same. For the fertility decoder, we do not use Equation 14 and 16 as fertility becomes redundant in this case. We still use the output to predict slot gates. Similar to TRADE, we use the summation of embedding vectors of each domain and slot pair as input to the state decoder and generate slot value token by token. First, From Table 6, we note that the performance does not change significantly as compared to the non-autoregressive version. This reveals that our proposed NADST models can predict fertilities reasonably well and performance is comparable with the auto-regressive approach. Second, we observe that the auto-regressive models are less sensitive to the use of system action in dialogue history delexicalization. We expect this as predicting slot gates is easier than predicting fertilities. Finally, we note that our auto-regressive model variants still outperform the existing approaches. This could be due to the high-level dependencies among (domain, slot) pairs learned during the first part of the model to predict slot gates.
<table><tr><td>MultiWOZ</td><td>Sys. Act</td><td>Joint Gate Acc</td><td>Joint Slot Acc</td><td>Slot Acc</td><td>Oracle Joint Slot Acc</td><td>Oracle Slot Acc</td></tr><tr><td>2.1</td><td>1</td><td>65.89%</td><td>49.76%</td><td>97.40%</td><td>71.39%</td><td>98.92%</td></tr><tr><td>2.1</td><td></td><td>62.04%</td><td>46.57%</td><td>97.23%</td><td>66.72%</td><td>98.65%</td></tr><tr><td>2.0</td><td>√</td><td>68.81%</td><td>50.08%</td><td>97.44%</td><td>79.04%</td><td>99.22%</td></tr><tr><td>2.0</td><td></td><td>65.27%</td><td>50.46%</td><td>97.43%</td><td>76.21%</td><td>99.08%</td></tr></table>
Table 6: Performance of auto-regressive model variants on MultiWOZ2.0 and 2.1. Fertility prediction is removed as fertility becomes redudant in auto-regressive models.
Visualization and Qualitative Evaluation. In Figure 4, we include two examples of dialogue state prediction and the corresponding visualization of self-attention scores of $X _ { d s \times f e r t }$ in state decoder. In each heatmap, the highlighted boxes express attention scores among non-symmetrical domain-slot pairs. In the first row, 5 attention heads capture the dependencies of two pairs (trainleaveat, train-arriveby) and (train-departure, train-destination). The model prediction for these two slots matches the gold labels: (train-leaveat, 09:50), (train-arriveby, 11:30) and (train-departure, cambridge), (train-destination, ely) respectively. In the second row, besides slot-level dependency between domain-slot pairs (taxi-departure, taxi-destination), token-level dependency is exhibited through the attention between attraction-type and attraction-name. By attending on token representations of attraction-name with corresponding output “christ college”, the models can infer “attraction-type=college” correctly. In addition, our model also detects contextual dependency between train-departure and attraction-name to predict “train-departure $\underline { { \underline { { \mathbf { \Pi } } } } }$ christ college.” Refer to Appendix A.4 for the dialogue history with gold and prediction states of these two sample dialogues.
# 5 CONCLUSION
We proposed NADST, a novel Non-Autoregressive neural architecture for DST that allows the model to explicitly learn dependencies at both slot-level and token-level to improve the joint accuracy rather than just individual slot accuracy. Our approach also enables fast decoding of dialogue states by adopting a parallel decoding strategy in decoding components. Our extensive experiments on the well-known MultiWOZ corpus for large-scale multi-domain dialogue systems benchmark show that our NADST model achieved the state-of-the-art accuracy results for DST tasks, while enjoying a substantially low inference latency which is an order of magnitude lower than the prior work.
# REFERENCES
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
Paweł Budzianowski, Tsung-Hsien Wen, Bo-Hsiang Tseng, Inigo Casanueva, Stefan Ultes, Osman ˜ Ramadan, and Milica Gasiˇ c. MultiWOZ - a large-scale multi-domain wizard-of-Oz dataset for ´ task-oriented dialogue modelling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 5016–5026, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1547. URL https://www. aclweb.org/anthology/D18-1547.
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ HyzdRiR9Y7.
Mihail Eric, Rahul Goel, Shachi Paul, Abhishek Sethi, Sanchit Agarwal, Shuyag Gao, and Dilek Hakkani-Tur. Multiwoz 2.1: Multi-domain dialogue state corrections and state tracking baselines. arXiv preprint arXiv:1907.01669, 2019.
Shuyang Gao, Abhishek Sethi, Sanchit Aggarwal, Tagyoung Chung, and Dilek Hakkani-Tur. Dialog state tracking: A neural reading comprehension approach. arXiv preprint arXiv:1908.01946, 2019.
Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Constant-time machine translation with conditional masked language models. arXiv preprint arXiv:1904.09324, 2019.
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249–256, 2010.
Rahul Goel, Shachi Paul, and Dilek Hakkani-Tur. Hyst: A hybrid approach for flexible and accurate ¨ dialogue state tracking. Proc. Interspeech 2019, pp. 1458–1462, 2019.
Alex Graves, Santiago Fernandez, Faustino Gomez, and J ´ urgen Schmidhuber. Connectionist tem- ¨ poral classification: labelling unsegmented sequence data with recurrent neural networks. In Proceedings of the 23rd international conference on Machine learning, pp. 369–376. ACM, 2006.
Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. Non-autoregressive neural machine translation. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ B1l8BtlCb.
Matthew Henderson, Blaise Thomson, and Jason D Williams. The second dialog state tracking challenge. In Proceedings of the 15th Annual Meeting of the Special Interest Group on Discourse and Dialogue (SIGDIAL), pp. 263–272, 2014a.
Matthew Henderson, Blaise Thomson, and Steve Young. Word-based dialog state tracking with recurrent neural networks. In Proceedings of the 15th Annual Meeting of the Special Interest Group on Discourse and Dialogue (SIGDIAL), pp. 292–299, 2014b.
Matthew Henderson, Blaise Thomson, and Steve J. Young. Robust dialog state tracking using delexicalised recurrent neural networks and unsupervised adaptation. 2014 IEEE Spoken Language Technology Workshop (SLT), pp. 360–365, 2014c.
Lukasz Kaiser, Samy Bengio, Aurko Roy, Ashish Vaswani, Niki Parmar, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. In International Conference on Machine Learning, pp. 2395–2404, 2018.
Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
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.
Gakuto Kurata, Bing Xiang, Bowen Zhou, and Mo Yu. Leveraging sentence-level information with encoder LSTM for semantic slot filling. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2077–2083, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1223. URL https: //www.aclweb.org/anthology/D16-1223.
Hwaran Lee, Jinsik Lee, and Tae yoon Kim. Sumbt: Slot-utterance matching for universal and scalable belief tracking. In ACL, 2019.
Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic non-autoregressive neural sequence modeling by iterative refinement. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1173–1182, 2018.
Wenqiang Lei, Xisen Jin, Min-Yen Kan, Zhaochun Ren, Xiangnan He, and Dawei Yin. Sequicity: Simplifying task-oriented dialogue systems with single sequence-to-sequence architectures. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1437–1447, 2018.
Jindˇrich Libovicky and Jind \` ˇrich Helcl. End-to-end non-autoregressive neural machine translation with connectionist temporal classification. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3016–3021, 2018.
Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1412–1421, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1166. URL https://www.aclweb. org/anthology/D15-1166.
Nikola Mrksiˇ c, Diarmuid ´ O S ´ eaghdha, Tsung-Hsien Wen, Blaise Thomson, and Steve Young. ´ Neural belief tracker: Data-driven dialogue state tracking. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1777– 1788. Association for Computational Linguistics, 2017. doi: 10.18653/v1/P17-1163. URL http://www.aclweb.org/anthology/P17-1163.
Elnaz Nouri and Ehsan Hosseini-Asl. Toward scalable neural dialogue state tracking model. arXiv preprint arXiv:1812.00899, 2018.
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
Osman Ramadan, Paweł Budzianowski, and Milica Gasic. Large-scale multi-domain belief tracking with knowledge sharing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, volume 2, pp. 432–437, 2018.
Abhinav Rastogi, Dilek Z. Hakkani-Tur, and Larry P. Heck. Scalable multi-domain dialogue state ¨ tracking. 2017 IEEE Automatic Speech Recognition and Understanding Workshop (ASRU), pp. 561–568, 2017.
Holger Schwenk. Continuous space translation models for phrase-based statistical machine translation. In Proceedings of COLING 2012: Posters, pp. 1071–1080, Mumbai, India, December 2012. The COLING 2012 Organizing Committee. URL https://www.aclweb.org/ anthology/C12-2104.
Abigail See, Peter J Liu, and Christopher D Manning. Get to the point: Summarization with pointergenerator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1073–1083, 2017.
Iulian V Serban, Alessandro Sordoni, Yoshua Bengio, Aaron Courville, and Joelle Pineau. Building end-to-end dialogue systems using generative hierarchical neural network models. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
Yangyang Shi, Kaisheng Yao, Hu Chen, Dong Yu, Yi-Cheng Pan, and Mei-Yuh Hwang. Recurrent support vector machines for slot tagging in spoken language understanding. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 393–399, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1044. URL https://www.aclweb.org/anthology/N16-1044.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5998–6008. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf.
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2692–2700. Curran Associates, Inc., 2015. URL http://papers.nips. cc/paper/5866-pointer-networks.pdf.
Yiren Wang, Fei Tian, Di He, Tao Qin, ChengXiang Zhai, and Tie-Yan Liu. Non-autoregressive machine translation with auxiliary regularization. In The Thirty-Third AAAI Conference on Artificial Intelligence (AAAI2019), pp. 5377–5384, 2019.
Tsung-Hsien Wen, David Vandyke, Nikola Mrksiˇ c, Milica Gasic, Lina M. Rojas Barahona, Pei-´ Hao Su, Stefan Ultes, and Steve Young. A network-based end-to-end trainable task-oriented dialogue system. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pp. 438–449, Valencia, Spain, April 2017. Association for Computational Linguistics. URL https://www.aclweb.org/ anthology/E17-1042.
Chien-Sheng Wu, Andrea Madotto, Ehsan Hosseini-Asl, Caiming Xiong, Richard Socher, and Pascale Fung. Transferable multi-domain state generator for task-oriented dialogue systems. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 808–819, Florence, Italy, July 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P19-1078.
Puyang Xu and Qi Hu. An end-to-end approach for handling unknown slot values in dialogue state tracking. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1448–1457. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/P18-1134.
Victor Zhong, Caiming Xiong, and Richard Socher. Global-locally self-attentive encoder for dialogue state tracking. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1458–1467, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1135. URL https: //www.aclweb.org/anthology/P18-1135.
# A APPENDIX
# A.1 DATASET PRE-PROCESSING
We follow similar data preprocessing procedures as Budzianowski et al. (2018) and Wu et al. (2019) on both MultiWOZ 2.0 and 2.1. The resulting corpus includes 8,438 multi-turn dialogues in training set with an average of 13.5 turns per dialogue. For the test and validation set, each includes 1,000 multi-turn dialogues with an average of 14.7 turns per dialogue. The average number of domains per dialogue is 1.8 for training, validation, and test sets. The MultiWOZ corpus includes much larger ontology than previous DST datasets such as WOZ (Wen et al., 2017) and DSTC2 (Henderson et al., 2014a). We identified a total of 35 (domain, slot) pairs across 7 domains. However, only 5 domains are included in the test data. Refer to Table 7 for the statistics of dialogues in these 5 domains.
Table 7: Summary of MultiWOZ dataset 2.1
<table><tr><td rowspan=1 colspan=1>Domain</td><td rowspan=1 colspan=1>attraction</td><td rowspan=1 colspan=1>hotel</td><td rowspan=1 colspan=1>restaurant</td><td rowspan=1 colspan=1>taxi</td><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>All</td></tr><tr><td rowspan=1 colspan=1>Slot</td><td rowspan=1 colspan=1>areanametype</td><td rowspan=1 colspan=1>areabookdaybookpeoplebookstayinternetnameparkingpricerangestarstype</td><td rowspan=1 colspan=1>areabookdaybookpeoplebooktimefoodnamepricerange</td><td rowspan=1 colspan=1>arrivebydeparturedestinationleaveat</td><td rowspan=1 colspan=1>arrivebybookpeopledaydeparturedestinationleaveat</td><td rowspan=1 colspan=1>=</td></tr><tr><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>3,381</td><td rowspan=1 colspan=1>3,103</td><td rowspan=1 colspan=1>2,717</td><td rowspan=1 colspan=1>3,813</td><td rowspan=1 colspan=1>1,654</td><td rowspan=1 colspan=1>8,438</td></tr><tr><td rowspan=1 colspan=1>val</td><td rowspan=1 colspan=1>416</td><td rowspan=1 colspan=1>484</td><td rowspan=1 colspan=1>401</td><td rowspan=1 colspan=1>438</td><td rowspan=1 colspan=1>207</td><td rowspan=1 colspan=1>1,000</td></tr><tr><td rowspan=1 colspan=1>test</td><td rowspan=1 colspan=1>394</td><td rowspan=1 colspan=1>494</td><td rowspan=1 colspan=1>395</td><td rowspan=1 colspan=1>437</td><td rowspan=1 colspan=1>195</td><td rowspan=1 colspan=1>1,000</td></tr></table>
# A.2 MODEL HYPER-PARAMETERS
We employed dropout (Srivastava et al., 2014) of 0.2 at all network layers except the linear layers of generation network components and pointer attention components. We used a batch size of 32, embedding dimension $d = 2 5 6$ in all experiments. We also fixed the number of attention heads to 16 in all attention layers. We shared the embedding weights to embed domain and slot tokens as input to fertility decoder and state decoder. We also shared the embedding weights between dialogue history encoder and state generator. We varied our models for different values of $T = T _ { f e r t } = T _ { s t a t e } \in$ $\{ 1 , 2 , 3 \}$ . In all experiments, the warmup steps are fine-tuned from a range from 13K to 20K training steps.
# A.3 ADDITIONAL RESULTS
Domain-specific Results. We conduct experiments to evaluate our model performance in all 5 test domains in MultiWOZ2.0 and 2.1. From Table 8, our models perform better in restaurant and attraction domain in general. The performance in the taxi and hotel domain is significantly lower than other domains. This could be explained as the hotel domain has a complicated slot ontology with 10 different slots, larger than the other domains. For the taxi domain, we observed that dialogues with this domain are usually of multiple domains, including the taxi domain in combination with other domains. Hence, it is more challenging to track dialogue states in the taxi domain.
Latency Results. We visualized the model latency against the length of dialogue history in Figure 2 and 3. In Figure 2, we only plot with dialogue history length up to 80 tokens as TSCP models do not use the full dialogue history as input. In Figure 3, for a fair comparison between TRADE and NADST, we plot the latency of the original TRADE which decodes dialogue state slot by slot and a new version of TRADE∗ model which decodes individual slots following a parallel decoding mechanism. Since TRADE independently generates dialogue state slot by slot, we enable parallel generation simply by feeding all slots into models at once (without impacts on performance). However, at the token level, TRADE∗ still follows an autoregressive decoding framework. Compared to TRADE∗ and TSCP, our model latency is only dependent on the model complexity i.e. the number of attention layers $T = T _ { f e r t } = T _ { s t a t e }$ . For TRADE∗ and TSCP, the model latency increases as dialogue extends over time while NADST latency is almost constant. The non-constant latency is mostly due to overhead processing such as delexicalizing dialogue history. Our approach is, hence, suitable especially for dialogues in multiple domains as they usually extend over more number of turns (e.g. 13 to 14 turns per dialogue in average in MultiWOZ corpus) In Figure 3, we noted that the latency of the original TRADE is almost unchanged as the dialogue history extends. This is most likely due to the model having to decode all possible (domain, slot) pairs rather than just relevant pairs as in NADST and TSCP. The TRADE∗ shows a clearer increasing trend of latency because the parallel process is independent of the number of (domain,slot) pairs considered. TRADE∗ still requires more time to decode than NADST as we also parallelize decoding at the token level.
Table 8: Additional domain-specific results of our model in MultiWOZ2.0 and MultiWOZ2.1. The model performs best with the restaurant domain and worst with the taxi domain.
<table><tr><td colspan="3">MultiWOZ2.1</td><td colspan="2">MultiWOZ2.0</td></tr><tr><td>Domain</td><td>Joint Acc</td><td>Slot</td><td>Joint Acc</td><td>Slot</td></tr><tr><td>Hotel</td><td>48.76%</td><td>97.70%</td><td>53.86%</td><td>97.75%</td></tr><tr><td>Train</td><td>62.36%</td><td>98.36%</td><td>58.58%</td><td>98.08%</td></tr><tr><td>Attraction</td><td>66.83%</td><td>98.89%</td><td>74.21%</td><td>99.19%</td></tr><tr><td>Restaurant</td><td>65.37%</td><td>98.78%</td><td>69.21%</td><td>98.84%</td></tr><tr><td>Taxi</td><td>33.80%</td><td>96.69%</td><td>34.94%</td><td>96.76%</td></tr></table>
 Figure 2: Comparison of model latency as wall-clock time (in ms) per prediction of complete dialogue state (not by individual slot). The latency is plotted against the length of the dialogue history. We compare our models with TSCP (Lei et al., 2018) with varied maximum output length of dialogue states $L = 8$ and $L = 2 0$ . We vary our models with different values of number of attention layers $T = T _ { f e r t } = T _ { s t a t e } = 1 , 2 , 3$ . Our models are more scalable as the latency does not change significantly when dialogue history extends over time.
Ablation Results. We conduct additional ablation experiments by varying the proportion of prediction values vs. ground-truth values for $X _ { d e l }$ and $X _ { d s \times f e r t }$ as input to the models. As can be seen in Table 9, the model performance increases gradually as the proportion of prediction input $\%$ pred reduces from $100 \%$ (true prediction) to $0 \%$ (oracle prediction). In particular, we observe more significant changes in performance against changes of $\%$ pred of $X _ { d s \times f e r t }$ . The model performance can increase up to more than $67 \%$ joint accuracy when we have an oracle input of $X _ { d s \times f e r t }$ . However, we consider improving model performance by $X _ { d e l }$ more practically achievable. For example, we can make use of a more sophisticated mechanism to delexicalize dialog history rather than exact word matching as the current strategy. Another example is having better $X _ { d e l }$ through a pretrained NLU model. In the ideal case with access to ground-truth labels of both $X _ { d e l }$ and $X _ { d s \times f e r t }$ , the model can obtain a joint accuracy of $73 \%$ .
 Figure 3: Comparison of model latency as wall-clock time (in ms) per prediction of complete dialogue state. The latency is plotted against the length of the dialogue history. For a fair comparison, we compare our models with TRADE (Wu et al., 2019) in 2 cases: original TRADE which decodes dialogue state slot by slot and TRADE∗ which decodes dialogue state in parallel at slot-level. Here we plot the base-10 logarithm of latency to show the difference between the 2 cases of TRADE. We vary our models with different values of number of attention layers $T = T _ { f e r t } = T _ { s t a t e } = 1 , 2 , 3$ . Our models are more scalable as the latency does not change significantly when dialogue history extends over time.
Table 9: Additional results of our model in MultiWOZ2.1 when we assume access to the groundtruth labels of $X _ { d e l }$ and $X _ { d s \times f e r t }$ (oracle prediction). We vary the the percentage of using the model prediction $\hat { X } _ { d e l }$ and $\hat { X } _ { d s \times f e r t }$ from $100 \%$ (true prediction) to $0 \%$ (oracle prediction).
<table><tr><td>%pred Xdel</td><td>%pred Xdsxfert</td><td>Joint Acc</td><td>Slot Acc</td><td>%pred Xdel</td><td>%pred Xdsxfert</td><td>Joint Acc</td><td>Slot Acc</td></tr><tr><td>0%</td><td>100%</td><td>57.40%</td><td>98.06%</td><td>100%</td><td>0%</td><td>67.32%</td><td>98.67%</td></tr><tr><td>20%</td><td>100%</td><td>56.50%</td><td>97.98%</td><td>100%</td><td>20%</td><td>64.09%</td><td>98.47%</td></tr><tr><td>40%</td><td>100%</td><td>55.24%</td><td>97.91%</td><td>100%</td><td>40%</td><td>61.29%</td><td>98.29%</td></tr><tr><td>60%</td><td>100%</td><td>53.58%</td><td>97.79%</td><td>100%</td><td>60%</td><td>57.02%</td><td>98.00%</td></tr><tr><td>80%</td><td>100%</td><td>52.02%</td><td>97.67%</td><td>100%</td><td>80%</td><td>54.11%</td><td>97.76%</td></tr><tr><td>100%</td><td>100%</td><td>49.04%</td><td>97.31%</td><td>100%</td><td>100%</td><td>49.04%</td><td>97.31%</td></tr><tr><td>0%</td><td>0%</td><td>73.44%</td><td>99.01%</td><td>0%</td><td>0%</td><td>73.44%</td><td>99.01%</td></tr></table>
 Figure 4: Heatmap visualization of self-attention scores of 5 heads between $\textstyle Z _ { d s \times f e r t }$ representations in the state decoder. The corresponding prediction output for each representation is presented on the right side. The examples are for the ${ \bf { \bar { 6 } } } ^ { t h }$ turn in dialogue ID MUL0536 (upper row) and PMUL3759 (lower row) in MultiWOZ2.1.
# A.4 SAMPLE PREDICTION OUTPUT
We extracted prediction output in all turns for 2 example dialogues: MUL0536 and PMUL3759.
Table 10: Full set of predicted dialogue states for dialogue ID MUL0536 in MultiWOZ2.1.
<table><tr><td>Human:</td><td></td><td>i am looking for abbey pool and astroturf pitch can you help me ?</td></tr><tr><td>Turn 1</td><td>Gold Dialog State:</td><td>(attraction-name,abbey pool and astroturf pitch)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-name,abbey pool and astroturf pitch)</td></tr><tr><td></td><td></td><td>yes,abbey pool and astroturf pitch is a swimmingpool east of town .their number is O1223902088,</td></tr><tr><td></td><td>System:</td><td>and address is pool way,whitehill road,off newmarket road . postcode cb58nt .</td></tr><tr><td>Turn 2</td><td>Human:</td><td>thank you very much for the information .that is alli needed help with . have a nice day.</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(attraction-area,east),(atraction-name,abbey pool and astroturf pitch),(atraction-type,swimming pool)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area, east),(attraction-name,abbey pool and astroturf pitch)</td></tr><tr><td></td><td>System:</td><td>you are welcome .let me know if i can do anything else for you .</td></tr><tr><td></td><td>Human:</td><td>i actually do need to find a train going to ely.</td></tr><tr><td>Turn 3</td><td>Gold Dialog State:</td><td>(attraction-area,east),(atraction-name,abbey pool and astroturf pitch),(attraction-type,swimming pool),</td></tr><tr><td></td><td></td><td>(train-destination-ely)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area, east),(atraction-name,abbey pool and astroturf pitch),(train-destination-ely)</td></tr><tr><td></td><td>System:</td><td>is that leaving from cambridge ?and if so,what time would you like to arrive in ely ?</td></tr><tr><td>Turn 4</td><td>Human:</td><td>yes,i willbe leaving cambridge and going toely,i would like it toarrive by 11:30. (atraction-area,east),(attraction-name,abbey pooland astroturf pitch),(attraction-type,swimming pool),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(train-arriveby,11:3O),(train-departure,cambridge),(train-destination, ely)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area, east),(atraction-name,abbey pool and astroturf pitch),(train-arriveby,11:30),</td></tr><tr><td></td><td></td><td>(train-departure,cambridge),(train-destination, ely) what day would yoube traveling ?there are 2,828 trains on that route.there isa train that departs friday at</td></tr><tr><td>Turn 5</td><td>System:</td><td>9:50 and will arrive in ely at 10:07 .</td></tr><tr><td></td><td>Human:</td><td>Oops !i guess forgot to mention it s thursday that i need to travel .</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(attraction-area,east),(atraction-name,abbey pool and astroturf pitch),(attraction-type,swimming pool), (train-arriveby,11:3O),(train-day,thursday),(train-departure,cambridge),(train-destination, ely)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area, east), (atraction-name,abbey pool and astroturf pitch),(train-arriveby,11:30),</td></tr><tr><td></td><td>System:</td><td>(train-day, thursday),(train-departure,cambridge),(train-destination, ely) there are 3 trains that would fit,leaving at O5:50,O7:50,or 09:50.</td></tr><tr><td>Turn 6</td><td>Human:</td><td>can i get info for the O9:5O the price and the trains id please ?</td></tr><tr><td></td><td></td><td>(attraction-area,east),(attraction-name,abbey pool and astroturf pitch),(atraction-type,swimming pool),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(train-arriveby,11:3O),(train-day,thursday),(train-departure,cambridge), (train-destination, ely), (train-leaveat, 09:50)</td></tr><tr><td></td><td></td><td>(attraction-area, east), (atraction-name,abbey pool and astroturf pitch),(train-arriveby,11:30),</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(train-day,thursday),(train-departure,cambridge),(train-destination,ely),(train-leaveat, 09:50)</td></tr><tr><td></td><td>System:</td><td>certainly .the train s id is tr1923,and the price for a ticket is 4.40 pounds .</td></tr><tr><td>Turn 7</td><td>Human:</td><td>great,thank you ! that will be allineed for now.</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(atraction-area,east), (attraction-name,abbey pool and astroturf pitch),(attraction-type,swimming pool), (train-arriveby,11:3O),(train-day,thursday),(train-departure,cambridge),(train-destination,ely),</td></tr><tr><td></td><td></td><td>(train-leaveat, 09:50) (attraction-area, east),(atraction-name,abbey pool and astroturf pitch),(train-arriveby,11:30),</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(train-day,thursday),(train-departure,cambridge),(train-destination,ely),(train-leaveat,09:50)</td></tr><tr><td></td><td>System:</td><td>are you certain you do not need further assistance ?</td></tr><tr><td>Turn 8</td><td>Human:</td><td>9:50 departure,4.40 pounds,trl923 .i got it,thank you ! (atraction-area,east), (attraction-name,abbey pooland astroturf pitch),(attraction-type,swimming pool),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(train-arriveby,11:3O), (train-day,thursday),(train-departure,cambridge),(train-destination,ely),</td></tr><tr><td></td><td></td><td>(train-leaveat, 09:50)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area,east),(atraction-name,abbey pool and astroturf pitch),(train-arriveby,11:30),</td></tr></table>
 Figure 5: Visualization of all attention heads in the last attention step $T _ { s t a t e }$ in the state decoder. The DST prediction is done for the $6 ^ { t h }$ turn in dialogue ID MUL0536 in MultiWOZ2.1.
Table 11: Full set of predicted dialogue states for dialogue ID PMUL3759 in MultiWOZ2.1.
<table><tr><td></td><td>Human:</td><td>what s your favorite college to visit in cambridge ?</td></tr><tr><td>Turn 1</td><td>Gold Dialog State:</td><td>(attraction-type,college)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-type,college)</td></tr><tr><td></td><td></td><td>ilike christ scollege in the center of town,but there are many others throughout the city.what part of</td></tr><tr><td></td><td>System:</td><td></td></tr><tr><td></td><td></td><td>the city did you want to visit ?</td></tr><tr><td>Turn 2 Human:</td><td></td><td>i think i would like to visit that location,it seems nice .could i get the phone number and the area ?</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(attraction-name,christ college),(attraction-type,college)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-area,centre),(attraction-name,christ college),(attraction-type,college)</td></tr><tr><td></td><td>System:</td><td>the area is centre and the phone number is O122333490o.is there anything else ican help you with ? actually,iam hungry .can you find me arestaurant that serves north american food ? something not</td></tr><tr><td></td><td>Turn 3Human:</td><td>super expensive,maybe in a moderate price range ?</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(araction-name,christ college),(attraction-type,college),(restaurant-food,modern american), (restaurant-pricerange, moderate)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-name,christ college),(attraction-type,college),(restaurant-food, north american),</td></tr><tr><td></td><td>System:</td><td>(restaurant-pricerange,moderate) iam sorry,there s no restaurant serving specifically north american or american food in my database,</td></tr><tr><td>Turn 4Human:</td><td></td><td>is there another type of food you would consider ? how about modern european food ?</td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(atraction-type,collge),(restaurant-food,modern european),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(restaurant-pricerange,moderate)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-name,christ college),(atraction-type,college),(restaurant-food, modern european), (restaurant-pricerange, moderate)</td></tr><tr><td></td><td>System:</td><td>there are 3 modern european restaurant -s 2 in the center and1 in the south .do you have a preference ?</td></tr><tr><td>Turn 5</td><td>Human:</td><td>i would prefer the 1 on the centre,could i have the phone number and postcode please ?</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(araction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td></td><td>(restaurant-food, modern european),(restaurant-pricerange,moderate)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-name,christ college),(atraction-type,college),(restaurant-area,centre), (restaurant-food, modern european),(restaurant-pricerange, moderate)</td></tr><tr><td></td><td>System:</td><td>de luca cucina and bar s phone number is O1223356666. postcode is cb2law.</td></tr><tr><td>Turn 6</td><td>Human:</td><td>could you help me get a taxi to get from the college to the restaurant ?</td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(restaurant-food,modern european),(restaurant-pricerange,moderate),(taxi-departure,christcolge), (taxi-destination,de luca cucina and bar)</td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(restaurant-food, modern european), (restaurant-pricerange,moderate),(taxi-departure,christ colge), (taxi-destination,de luca cucina and bar)</td></tr><tr><td></td><td>System:</td><td>what time would you like to leave thecollege?icanbook youataxi to take you to the restaurant if you</td></tr><tr><td>Turn 7</td><td></td><td>would like.</td></tr><tr><td></td><td>Human:</td><td>i would like to leave by 13:00. (attraction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(restaurant-food, modern european),(restaurant-pricerange,moderate), (taxi-departure,christ collge),</td></tr><tr><td></td><td></td><td>(taxi-destination,de luca cucina and bar),(taxi-leaveat,12:45)</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(attraction-name,christ college),(attraction-type,college), (restaurant-area,centre), (restaurant-food, modern european), (restaurant-pricerange,moderate),(taxi-departure,christcolge),</td></tr><tr><td></td><td></td><td>(taxi-destination,de luca cucina and bar),(taxi-leaveat,13:00)</td></tr><tr><td></td><td>System:</td><td>ihave booked youataxi leaving at12:45.the car will beared toyotaand contact number is O7350032543 .anything else today ?</td></tr><tr><td>Turn 8Human:</td><td></td><td>that s it .thank you very much .</td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(attraction-type,college), (restaurant-area,centre),</td></tr><tr><td></td><td>Gold Dialog State:</td><td>(restaurant-food, modern european),(restaurant-pricerange,moderate), (taxi-departure,christ collge),</td></tr><tr><td></td><td></td><td>(taxi-destination,de luca cucina and bar),(taxi-leaveat,12:45)</td></tr><tr><td></td><td></td><td>(araction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td>Predicted Dialog State:</td><td>(restaurant-food, modern european), (restaurant-pricerange,moderate),(taxi-departure,christ college),</td></tr><tr><td></td><td></td><td>(taxi-destination,de luca cucina and bar),(taxi-leaveat,12:45)</td></tr><tr><td></td><td>System:</td><td>will you need anymore information concerning your stay ?</td></tr><tr><td></td><td></td><td>that is all,thanks for the help.</td></tr><tr><td>Turn 9</td><td>Human:</td><td></td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Gold Dialog State:</td><td>(restaurant-food,modern european),(restaurant-pricerange,moderate), (taxi-departure,christ college),</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>(taxi-destination,de luca cucina and bar),(taxi-leaveat,12:45)</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>(attraction-name,christ college),(attraction-type,college),(restaurant-area,centre),</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Predicted Dialog State:</td><td></td><td></td></tr></table>
 Figure 6: Visualization of all attention heads in the last attention step $T _ { s } t a t e$ in the state decoder. The DST prediction is done for the $6 ^ { t h }$ turn in dialogue ID PMUL3759 in MultiWOZ2.1.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396# DATA AUGMENTATION INSTEAD OFEXPLICIT REGULARIZATION
Anonymous authors Paper under double-blind review
# ABSTRACT
Modern deep artificial neural networks have achieved impressive results through models with orders of magnitude more parameters than training examples which control overfitting with the help of regularization. Regularization can be implicit, as is the case of stochastic gradient descent and parameter sharing in convolutional layers, or explicit. Explicit regularization techniques, most common forms are weight decay and dropout, have proven successful in terms of improved generalization, but they introduce sensitive hyper-parameters and, incongruously, often require deeper and wider architectures to compensate for the reduced capacity. In contrast, data augmentation techniques exploit domain knowledge to increase the number of training examples and improve generalization without reducing the representational capacity and without introducing model-dependent parameters, since it is applied on the training data. In this paper we systematically contrast data augmentation and explicit regularization on three popular architectures and three image object classification data sets. Our results demonstrate that data augmentation alone can achieve the same performance or higher as regularized models and exhibits much higher adaptability to changes in the architecture and the amount of training data.
# 1 INTRODUCTION
One of the central issues in machine learning research and application is finding ways of improving generalization. Regularization, loosely defined as any modification applied to a learning algorithm that helps prevent overfitting, plays therefore a key role in machine learning (Girosi et al., 1995; Müller, 2012). In the case of deep learning, where neural networks tend to have several orders of magnitude more parameters than training examples, statistical learning theory (Vapnik & Chervonenkis, 1971) indicates that regularization becomes even more crucial. Accordingly, a myriad of techniques have been proposed as regularizers: weight decay (Hanson & Pratt, 1989) and other $L ^ { p }$ penalties; dropout (Srivastava et al., 2014) and stochastic depth (Huang et al., 2016), to name a few examples. Moreover, whereas in simpler machine learning algorithms the regularizers can be easily identified as explicit terms in the objective function, in modern deep neural networks the sources of regularization are not only explicit, but implicit (Neyshabur et al., 2014). In this regard, many techniques have been studied for their regularization effect, despite not being explicitly intended as such. That is the case of unsupervised pre-training (Erhan et al., 2010), multi-task learning (Caruana, 1998), convolutional layers (LeCun et al., 1990), batch normalization (Ioffe & Szegedy, 2015) or adversarial training (Szegedy et al., 2013). In sum, there are multiple elements in deep learning that contribute to reduce overfitting and thus improve generalization.
Driven by the success of such techniques and the efficient use of GPUs, considerable research effort has been devoted to finding ways of training deeper and wider networks with larger capacity (Simonyan & Zisserman, 2014; He et al., 2016; Zagoruyko & Komodakis, 2016). Ironically, the increased representational capacity is eventually reduced in practice by the use of explicit regularization, most commonly weight decay and dropout. It is known, for instance, that the gain in generalization provided by dropout comes at the cost of using larger models and training for longer (Goodfellow et al., 2016). Hence, it seems that with these standard regularization methods deep networks are wasting capacity (Dauphin & Bengio, 2013).
Unlike explicit regularization, data augmentation improves generalization without reducing the capacity of the model. Data augmentation, that is synthetically expanding a data set by applying transformations on the available examples, has been long used in machine learning (Simard et al., 1992) and identified as a critical component of many recent successful models, like AlexNet (Krizhevsky et al., 2012), All-CNN (Springenberg et al., 2014) or ResNet (He et al., 2016), among others. Although it is most popular in computer vision, data augmentation has also proven effective in speech recognition (Jaitly & Hinton, 2013), music source separation (Uhlich et al., 2017) or text categorization (Lu et al., 2006). Today, data augmentation is an almost ubiquitous technique in deep learning, which can also be regarded as an implicit regularizer for it improves generalization.
Recently, the deep learning community has become more aware of the importance of data augmentation (Hernández-García & König, 2018b) and new techniques, such as cutout (DeVries & Taylor, 2017a) or augmentation in the feature space (DeVries & Taylor, 2017b), have been proposed. Very interestingly, a promising avenue for future research has been set by recently proposed models that automatically learn the data transformations (Hauberg et al., 2016; Lemley et al., 2017; Ratner et al., 2017; Antoniou et al., 2017). Nonetheless, another study by Perez & Wang (2017) analyzed the performance of different techniques for object recognition and concluded that one of the most successful techniques so far is still the traditional data augmentation carried out in most studies.
However, despite its popularity, the literature lacks, to our knowledge, a systematic analysis of the impact of data augmentation on convolutional neural networks compared to explicit regularization. It is a common practice to train the models with both explicit regularization, typically weight decay and dropout, and data augmentation, assuming they all complement each other. Zhang et al. (2017) included data augmentation in their analysis of generalization of deep networks, but it was questionably considered an explicit regularizer similar to weight decay and dropout. To our knowledge, the first time data augmentation and explicit regularization were systematically contrasted was the preliminary study by Hernández-García & König (2018b). The present work aims at largely extending that work both with more empirical results and a theoretical discussion.
Our specific contributions are the following:
• Propose definitions of explicit and implicit regularization that aim at solving the ambiguity in the literature (Section 2). • A theoretical discussion based on statistical learning theory about the differences between explicit regularization and data augmentation, highlighting the advantages of the latter (Section 3). • An empirical analysis of the performance of models trained with and without explicit regularization, and different levels of data augmentation on several benchmarks (Sections 4 and 5). Further, we study their adaptability to learning from fewer examples (Section 5.2) and to changes in the architecture (Section 5.3). • A discussion on why encouraging data augmentation instead of explicit regularization can benefit both theory and practice in deep learning (Section 6).
# 2 EXPLICIT AND IMPLICIT REGULARIZATION
Zhang et al. (2017) raised the thought-provoking idea that “explicit regularization may improve generalization performance, but is neither necessary nor by itself sufficient for controlling generalization error.” The authors came to this conclusion from the observation that turning off the explicit regularizers of a model does not prevent the model from generalizing reasonably well. This contrasts with traditional machine learning involving convex optimization, where regularization is necessary to avoid overfitting and generalize (Vapnik & Chervonenkis, 1971). Such observation led the authors to suggest the need for “rethinking generalization” in order to understand deep learning.
We argue it is not necessary to rethink generalization if we instead rethink regularization and, in particular, data augmentation. Despite their thorough analysis and relevant conclusions, Zhang et al. (2017) arguably underestimated the role of implicit regularization and considered data augmentation an explicit form of regularization much like weight decay and dropout. This illustrates that the terms explicit and implicit regularization have been used subjectively and inconsistently in the literature before. In order to avoid the ambiguity and facilitate the discussion, we propose the following definitions of explicit and implicit regularization1:
• Explicit regularization techniques are those which reduce the representational capacity of the model they are applied on. That is, given a model class $\mathcal { H } _ { 0 }$ , for instance a neural network architecture, the introduction of explicit regularization will span a new hypothesis set $\mathcal { H } _ { 1 }$ , which is a proper subset of the original set, i.e. $\mathcal { H } _ { 1 } \subsetneq \mathcal { H } _ { 0 }$ .
• Implicit regularization is the reduction of the generalization error or overfitting provided by means other than explicit regularization techniques. Elements that provide implicit regularization do not reduce the representational capacity, but may affect the effective capacity of the model, that is the achievable set of hypotheses given the model, the optimization algorithm, hyperparameters, etc.
One of the most common explicit regularization techniques in machine learning is $L ^ { p }$ -norm regularization, of which weight decay is a particular case, widely used in deep learning. Weight decay sets a penalty on the $L ^ { 2 }$ norm of the learnable parameters, thus constraining the representational capacity of the model. Dropout is another common example of explicit regularization, where the hypothesis set is reduced by stochastically deactivating a number of neurons during training. Similar to dropout, stochastic depth, which drops whole layers instead of neurons, is also an explicit regularization technique.
There are multiple elements in deep neural networks that implicitly regularize the models. Note, in this regard, that the above definition, contrary to explicit regularization, does not refer to techniques, but to a regularization effect, as it can be provided by elements of very different nature. For instance, stochastic gradient descent (SGD) is known to have an implicit regularization effect without constraining the representational capacity. Batch normalization does not either reduce the capacity, but it improves generalization by smoothing the optimization landscape Santurkar et al. (2018). Of quite a different nature, but still implicit, is the regularization effect provided by early stopping, which does not reduce the representational, but the effective capacity.
By analyzing the literature, we identified some previous pieces of work which, lacking a definition of explicit and implicit regularization, made a distinction apparently based on the mere intention of the practitioner. Under such notion, data augmentation has been considered in some cases an explicit regularization technique, as in Zhang et al. (2017). Here, we have provided definitions for explicit and implicit regularization based on their effect on the representational capacity and argue that data augmentation is not explicit, but implicit regularization, since it does not affect the representational capacity of the model.
# 3 THEORETICAL INSIGHTS
The generalization of a model class $\mathcal { H }$ can be analyzed through complexity measures such as the VC-dimension or, more generally, the Rademacher complexity $\mathcal { \bar { R } } _ { n } ( \mathcal { H } ) = \mathbb { E } _ { S \sim D ^ { n } } \left[ \hat { \mathcal { R } } _ { S } ( \mathcal { H } ) \right]$ , where:
$$\hat { \mathcal { R } } _ { S } ( \mathcal { H } ) = \mathbb { E } _ { \sigma } \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } h ( x _ { i } ) \right| \right]$$
is the empirical Rademacher complexity, defined with respect to a set of data samples $S = ( x _ { i } , . . . , x _ { n } )$ . Then, in the case of binary classification and the class of linear separators, the generalization error of a hypothesis, $\hat { \epsilon } _ { S } ( h )$ , can be bounded using the Rademacher complexity:
$$\hat { \epsilon } _ { S } ( h ) \leq \mathcal { R } _ { n } ( \mathcal { H } ) + \mathcal { O } \left( \sqrt { \frac { \ln ^ { 1 } / \delta } { n } } \right)$$
with probability $1 - \delta$ . Tighter bounds for some model classes, such as fully connected neural networks, can be obtained (Bartlett $\&$ Mendelson, 2002), but it is not trivial to formally analyze the influence on generalization of specific architectures or techniques.
Nonetheless, we can use these theoretical insights to discuss the differences between explicit regularization—particularly weight decay and dropout—and implicit regularization—particularly data augmentation. A straightforward yet very relevant conclusion from the analysis of any generalization bound is the strong dependence on the number of training examples $n$ . Increasing $n$ drastically improves the generalization guarantees, as reflected by the second term in RHS of Equation 1 and the dependence of the Rademacher complexity (LHS) on the sample size as well. Data augmentation exploits prior knowledge of the data domain $D$ to create new examples and its impact on generalization is related to an increment in $n$ , since stochastic data augmentation can generate virtually infinite different samples. Admittedly, the augmented samples are not independent and identically distributed and thus, the effective increment of samples does not strictly correspond to the increment in $n$ . This is why formally analyzing the impact of data augmentation on generalization is complex and out of the scope of this paper. Recently, some studies have taken steps in this direction by analyzing the effect of simplified data transformations on generalization from a theoretical point of view Chen et al. (2019); Rajput et al. (2019).
In contrast, explicit regularization methods aim, in general, at improving the generalization error by constraining the hypothesis class $\mathcal { H }$ , which hopefully should reduce its complexity, $\textstyle { \mathcal { R } } _ { n } ( { \mathcal { H } } )$ , and, in turn, the generalization error $\hat { \epsilon } _ { S } ( h )$ . Crucially, while data augmentation exploits domain knowledge, most explicit regularization methods only naively constrain the hypothesis class. For instance, weight decay constrains the learnable models $\mathcal { H }$ by setting a penalty on the weights norm. However, Bartlett et al. (2017) have recently shown that weight decay has little impact on the generalization bounds and confidence margins.
Dropout has been extensively used and studied as a regularization method for neural networks (Wager et al., 2013), but the exact way in which dropout may improve generalization is still an open question and it has been concluded that the effects of dropout on neural networks are somewhat mysterious, complicated and its penalty highly non-convex (Helmbold & Long, 2017). Recently, Mou et al. (2018) have established new generalization bounds on the variance induced by a particular type of dropout on feedforward neural network. Nevertheless, dropout can also be analyzed as a random form of data augmentation without domain knowledge Bouthillier et al. (2015), that is data-dependent regularization. Therefore, any generalization bound derived for dropout can be regarded as a pessimistic bound for domain-specific, standard data augmentation.
A similar argument applies for weight decay, which, as first shown by Bishop (1995), is equivalent to training with noisy examples if the noise amplitude is small and the objective is the sum-of-squares error function. In sum, many forms of explicit regularization are at least approximately equivalent to adding random noise to the training examples, which is the simplest form of data augmentation2. Thus, it is reasonable to argue that more sophisticated data augmentation can overshadow the benefits provided by explicit regularization.
In general, we argue that the reason why explicit regularization may not be necessary is that neural networks are already implicitly regularized by many elements—stochastic gradient descent (SGD), convolutional layers, normalization and data augmentation, to name a few—that provide a more successful inductive bias (Neyshabur et al., 2014). For instance, it has been shown that linear models optimized with SGD converge to solutions with small norm, without any explicit regularization (Zhang et al., 2017). In the remainder of the paper, we present a set of experiments that shed more light on the advantages of data augmentation over weight decay and dropout.
# 4 METHODS
This section describes the experimental setup for systematically analyzing the role of data augmentation in deep neural networks compared to weight decay and dropout and builds upon the methods used in preliminary studies (Hernández-García & König, 2018a;b; Zhang et al., 2017).
# 4.1 NETWORK ARCHITECTURES
We perform our experiments on three distinct, popular architectures that have achieved successful results in object recognition tasks: the all convolutional network, All-CNN (Springenberg et al.,
2014); the wide residual network, WRN (Zagoruyko & Komodakis, 2016); and the densely connected network, DenseNet (Huang et al., 2017). Importantly, we keep the same training hyper-parameters (learning rate, training epochs, batch size, optimizer, etc.) as in the original papers in the cases they are reported. Below we present the main features of each network and more details can be found in the supplementary material.
• All-CNN: it consists only of convolutional layers with ReLU activation (Glorot et al., 2011), it is relatively shallow and has few parameters. For ImageNet, the network has 16 layers and 9.4 million parameters; for CIFAR, it has 12 layers and 1.3 million parameters. In our experiments to compare the adaptability of data augmentation and explicit regularization to changes in the architecture, we also test a shallower version, with 9 layers and 374,000 parameters, and a deeper version, with 15 layers and 2.4 million parameters. WRN: a residual network, ResNet (He et al., 2016), that achieves better performance with fewer layers, but more units per layer. Here, we choose for our experiments the WRN-28-10 version (28 layers and about $3 6 . 5 \mathrm { ~ M ~ }$ parameters), which is reported to achieve the best results on CIFAR. DenseNet: a network architecture arranged in blocks whose layers are connected to all previous layers, allowing for very deep architectures with few parameters. Specifically, for our experiments we use a DenseNet-BC with growth rate $k = 1 2$ and 16 layers in each block, which has a total of 0.8 million parameters.
# 4.2 DATA
We perform the experiments on the highly benchmarked data sets ImageNet (Russakovsky et al., 2015) ILSVRC 2012, CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009). We resize the $1 . 3 { \bf M }$ images from ImageNet into $1 5 0 \times 2 0 0$ pixels, as a compromise between keeping a high resolution and speeding up the training. Both on ImageNet and on CIFAR, the pixel values are in the range [0, 1] and have 32 bits floating precision.
So as to analyze the role of data augmentation, we train every network architecture with two different augmentation schemes as well as with no data augmentation at all:
• Light augmentation: This scheme is common in the literature, for example (Goodfellow et al., 2013; Springenberg et al., 2014), and performs only horizontal flips and horizontal and vertical translations of $10 \%$ of the image size. • Heavier augmentation: This scheme performs a larger range of affine transformations such as scaling, rotations and shear mappings, as well as contrast and brightness adjustment. On ImageNet we additionally perform a random crop of $1 2 8 \times 1 2 8$ pixels. The choice of the allowed transformations is arbitrary and the only criterion was that the objects are still recognizable in general. We deliberately avoid designing a particularly successful scheme. The details of the heavier scheme can be consulted in the supplementary material.
# 4.3 TRAIN AND TEST
Every architecture is trained on each data set both with explicit regularization—weight decay and dropout as specified in the original papers—and with no explicit regularization. Furthermore, we train each model with the three data augmentation schemes. The performance of the models is computed on the held out test tests. As in previous works (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014), we average the softmax posteriors over 10 random light augmentations, since slightly better results are obtained.
All the experiments are performed on Keras (Chollet et al., 2015) on top of TensorFlow (Abadi et al., 2015) and on a single GPU NVIDIA GeForce GTX 1080 Ti.
# 5 RESULTS
This section presents the most relevant results of the experiments comparing the roles of data augmentation and explicit regularization on convolutional neural networks. First, we present the experiments with the original architectures in section 5.1. Then, Sections 5.2 and 5.3 show the results of training the models with fewer training examples and with shallower and deeper versions of the All-CNN architecture.
The figures aim at facilitating the comparison between the models trained with and without explicit regularization, as well as between the different levels of data augmentation. The purple bars (top of each pair) correspond to the models trained without explicit regularization—weight decay and dropout—and the red bars (bottom) to the models trained with it. The different color shades correspond to the three augmentation schemes. The figures show the relative performance of each model with respect to a particular baseline in order to highlight the relevant comparisons. A detailed and complete report of all the results can be found in the supplementary material. The results on CIFAR refer to the top-1 test accuracy while on ImageNet we report the top-5.
 5.1 AN ALTERNATIVE TO EXPLICIT REGULARIZATION Figure 1: Relative improvement of adding data augmentation and explicit regularization to the baseline models, $( a c c u r a c y - b a s e l i n e ) / a c c u r a c y * 1 0 0$ . The baseline accuracy is shown on the left. The results suggest that data augmentation alone (purple bars) can achieve even better performance than the models trained with both weight decay and dropout (red bars).
First, we contrast the regularization effect of data augmentation and weight decay and dropout on the original networks trained with the complete data sets. For that purpose, in Figure 1 we show the relative improvement in test performance achieved by adding each technique or combination of techniques to the baseline model, that is the model trained with neither explicit regularization nor data augmentation (see the left of the bars). Table 1 shows the mean and standard deviation of each combination.3
Table 1: Average accuracy improvement over the baseline model of each combination of data augmentation level and presence of weight decay and dropout.
<table><tr><td colspan="2">No explicit reg.</td><td>Weight decay+ dropout</td></tr><tr><td>None</td><td>baseline</td><td>3.02 (1.65)</td></tr><tr><td>Light</td><td>8.46 (3.80)</td><td>7.88 (2.60)</td></tr><tr><td>Heavier</td><td>8.68 (4.69)</td><td>7.92 (4.03)</td></tr></table>
Several conclusions can be extracted from Figure 1 and Table 1. Most importantly, training with data augmentation alone (top, purple bars) improves the performance in most cases as much as or even more than training with both augmentation and explicit regularization (bottom, red bars), on average

 (a) $50 \%$ of the available training data Figure 2: Fraction of the baseline performance when the amount of available training data is reduced, accuracy/baseline $* 1 0 0$ . The models trained wit explicit regularization present a significant drop in performance as compared to the models trained with only data augmentation. The differences become larger as the amount of training data decreases.
8.57 and $7 . 9 0 \%$ respectively. This is quite a surprising and remarkable result: note that the studied architectures achieved state-of-the-art results at the moment of their publication and the models included both light augmentation and weight decay and dropout, whose parameters were presumably finely tuned to achieve higher accuracy. The replication of these results corresponds to the middle red bars in Figure 1. We show here that simply removing weight decay and dropout—while even keeping all other hyperparameters intact, see Section 4.1—improves the formerly state-of-the-art accuracy in 4 of the 8 studied cases.
Second, it can also be observed that the regularization effect of weight decay and dropout, an average improvement of $3 . 0 2 \%$ with respect to the baseline,1 is much smaller than that of data augmentation. Simply applying light augmentation increases the accuracy in $8 . 4 6 \%$ on average.
Finally, note that even though the heavier augmentation scheme was deliberately not designed to optimize the performance, in both CIFAR-10 and CIFAR-100 it improves the test performance with respect to the light augmentation scheme. This is not the case on ImageNet, probably due to the increased complexity of the data set. It can be observed though that the effects are in general more consistent in the models trained without explicit regularization. In sum, it seems that the performance gain achieved by weight decay and dropout can be achieved and often improved by data augmentation alone.
# 5.2 FEWER AVAILABLE TRAINING EXAMPLES
We argue that one of the main drawbacks of explicit regularization techniques is their poor adaptability to changes in the conditions with which the hyperparameters were tuned. To test this hypothesis and contrast it with the adaptability of data augmentation, here we extend the analysis by training the same networks with fewer examples. The models are trained with the same random subset of data and evaluated in the same test set as the previous experiments. In order to better visualize how well each technique resists the reduction of training data, in Figure 2 we show the fraction of baseline accuracy achieved by each model when trained with $50 \%$ and $10 \%$ of the available data. In this case, the baseline is thus each corresponding model trained with the complete data set. Table 2 summarizes the mean and standard deviation of each combination. An extended report of results, including additional experiments with $80 \%$ and $1 \%$ of the data, is provided in the supplementary material.
Table 2: Average fraction of the original accuracy of each corresponding combination of data augmentation level and presence of weight decay and dropout.
<table><tr><td rowspan="2"></td><td colspan="2">50 % of the training data</td><td colspan="2">10 % of the training data</td></tr><tr><td>No explicit reg.</td><td>WD + dropout</td><td>No explicit reg.</td><td>WD + dropout</td></tr><tr><td>None</td><td>88.11 (6.27)</td><td>83.20 (9.83)</td><td>58.72 (14.93)</td><td>58.75 (16.92)</td></tr><tr><td>Light</td><td>91.47 (4.31)</td><td>88.27 (7.39)</td><td>67.55 (14.27)</td><td>60.89 (18.39)</td></tr><tr><td>Heavier</td><td>91.82 (4.63)</td><td>89.28 (6.63)</td><td>68.69 (13.61)</td><td>61.43 (15.90)</td></tr></table>
 Figure 3: Fraction of the original performance when the depth of the All-CNN architecture is increased or reduced in 3 layers. In the explicitly regularized models, the change of architecture implies a dramatic drop in the performance, while the models trained without explicit regularization present only slight variations with respect to the original architecture.
One of the main conclusions of this set of experiments is that if no data augmentation is applied, explicit regularization hardly resist the reduction of training data by itself. On average, with $50 \%$ of the available data, these models only achieve $8 3 . 2 0 \%$ of the original accuracy, which, remarkably, is worse than the models trained without any explicit regularization $( 8 8 . 1 1 \% )$ . On $10 \%$ of the data, the average fraction is the same (58.75 and $5 8 . 7 2 \%$ , respectively). This implies that training with explicit regularization is even detrimental for the performance.
When combined with data augmentation, the models trained with explicit regularization (bottom, red bars) also perform worse (88.78 and $6 1 . 1 6 \%$ with 50 and $10 \%$ of the data, respectively), than the models with just data augmentation (top, purple bars, 91.64 and $6 8 . 1 2 \%$ on average). Note that the difference becomes larger as the amount of available data decreases. Importantly, it seems that the combination of explicit regularization and data augmentation is only slightly better than training without data augmentation. We can think of two reasons that could explain this: first, the original regularization hyperparameters seem to adapt poorly to the new conditions. The hyperparameters are specifically tuned for the original setup and one would have to re-tune them to achieve comparable results. Second, since explicit regularization reduces the representational capacity, this might prevent the models from taking advantage of the augmented data.
In contrast, the models trained without explicit regularization more naturally adapt to the reduced availability of data. With $50 \%$ of the data, these models, trained with data augmentation achieve about $91 . 5 \%$ of the performance with respect to training with the complete data sets. With only $10 \%$ of the data, they achieve nearly $70 \%$ of the baseline performance, on average. This highlights the suitability of data augmentation to serve, to a great extent, as true, useful data (Vinyals et al., 2016).
# 5.3 SHALLOWER AND DEEPER ARCHITECTURES
Finally, in this section we test the adaptability of data augmentation and explicit regularization to changes in the depth of the All-CNN architecture (see Section 4.1). We show the fraction of the performance with respect to the original architecture in Figure 3.
A noticeable result from Figure 3 is that all the models trained with weight decay and dropout (bottom, red bars) suffer a dramatic drop in performance when the architecture changes, regardless of whether it becomes deeper or shallower and of the amount of data augmentation. As in the case of reduced training data, this may be explained by the poor adaptability of the regularization hyperparameters, which highly depend on the architecture.
This highly contrasts with the performance of the models trained without explicit regularization (top, purple bars). With a deeper architecture, these models achieve slightly better performance, effectively exploiting the increased capacity. With a shallower architecture, they achieve only slightly worse performance4. Thus, these models seem to more naturally adapt to the new architecture and data augmentation becomes beneficial.
It is worth commenting on the particular case of the CIFAR-100 benchmark, where the difference between the models with and without explicit regularization is even more pronounced, in general. It is a common practice in object recognition papers to tune the parameters for CIFAR-10 and then test the performance on CIFAR-100 with the same hyperparameters. Therefore, these are typically less suitable for CIFAR-100. We believe this is the reason why the benefits of data augmentation seem even more pronounced on CIFAR-100 in our experiments.
In sum, these results highlight another crucial advantage of data augmentation: the effectiveness of its hyperparameters, that is the type of image transformations, depend mostly on the type of data, rather than on the particular architecture or amount of available training data, unlike explicit regularization hyperparameters. Therefore, removing explicit regularization and training with data augmentation increases the flexibility of the models.
# 6 DISCUSSION
We have presented a systematic analysis of the role of data augmentation in deep convolutional neural networks for object recognition, focusing on the comparison with popular explicit regularization techniques—weight decay and dropout. In order to facilitate the discussion and the analysis, we first proposed in Section 2 definitions of explicit and implicit regularization, which have been ambiguously used in the literature. Accordingly, we have argued that data augmentation should not be considered an explicit regularizer, such as weight decay and dropout. Then, we provided some theoretical insights in Section 3 that highlight some advantages of data augmentation over explicit regularization. Finally, we have empirically shown that explicit regularization is not only unnecessary (Zhang et al., 2017), but also that its generalization gain can be achieved by data augmentation alone. Moreover, we have demonstrated that, unlike data augmentation, weight decay and dropout exhibit poor adaptability to changes in the architecture and the amount of training data.
Despite the limitations of our empirical study, we have chosen three significantly distinct network architectures and three data sets in order to increase the generality of our conclusions, which should ideally be confirmed by future work on a wider range of models, data sets and even other domains such text or speech. It is important to note, however, that we have taken a conservative approach in our experimentation: all the hyperparameters have been kept as in the original models, which included both weight decay and dropout, as well as light augmentation. This setup is clearly suboptimal for models trained without explicit regularization. Besides, the heavier data augmentation scheme was deliberately not optimized to improve the performance and it was not the scope of this work to propose a specific data augmentation technique. As future work, we plan to propose data augmentation schemes that can more successfully be exploited by any deep model.
The relevance of our findings lies in the fact that explicit regularization is currently the standard tool to enable the generalization of most machine learning methods and is included in most convolutional neural networks. However, we have empirically shown that simply removing the explicit regularizers often improves the performance or only marginally reduces it, if some data augmentation is applied. These results are supported by the theoretical insights provided in in Section 3.
Zhang et al. (2017) suggested that regularization might play a different role in deep learning, not fully explained by statistical learning theory (Vapnik & Chervonenkis, 1971). We have argued instead that the theory still naturally holds in deep learning, as long as one considers the crucial role of implicit regularization: explicit regularization seems to be no longer necessary because its contribution is already provided by the many elements that implicitly and successfully regularize the models: to name a few, stochastic gradient descent, convolutional layers and data augmentation.
# 6.1 RETHINKING DATA AUGMENTATION
Data augmentation is often regarded by authors of machine learning papers as cheating, something that should not be used in order to test the potential of a newly proposed architecture (Goodfellow et al., 2013; Graham, 2014; Larsson et al., 2016). In contrast, weight decay and dropout are almost ubiquitous and considered intrinsic elements of the algorithms. In view of the results presented here, we believe that the deep learning community would benefit if we rethink data augmentation and switch roles with explicit regularization: a good model should generalize well without the need for explicit regularization and successful methods should effectively exploit data augmentation.
In this regard it is worth highlighting some of the advantages of data augmentation: Not only does it not reduce the representational capacity of the model, unlike explicit regularization, but also, since the transformations reflect plausible variations of the real objects, it increases the robustness of the model and it can be seen as a data-dependent prior, similarly to unsupervised pre-training (Erhan et al., 2010). Novak et al. (2018) have shown that data augmentation consistently yields models with smaller sensitivity to perturbations. Interestingly, recent work has found that models trained with heavier data augmentation learn representations that are more similar to the inferior temporal (IT) cortex, highlighting the biological plausibility of data augmentation (Hernández-García et al., 2018).
Deep neural networks are especially well suited for data augmentation because they do not rely on pre-computed features and because the large number of parameters allows them to shatter the augmented training set. Moreover, unlike explicit regularization, data augmentation can be performed on the CPU, in parallel to the gradient updates. Finally, an important conclusion from Sections 5.2 and 5.3 is that data augmentation naturally adapts to architectures of different depth and amounts of available training data, whereas explicitly regularized models are highly sensitive to such changes and need specific fine-tuning of their hyperparameters. In sum, data augmentation seems to be a strong alternative to explicit regularization techniques.
Some argue that despite these advantages, data augmentation is a limited approach because it depends on some prior expert knowledge and it cannot be applied to all domains. However, we argue instead that expert knowledge should not be disregarded but exploited. A single data augmentation scheme can be designed for a broad family of data (for example, natural images) and effectively applied to a broad set of tasks (for example, object recognition, segmentation, localization, etc.). Besides, interesting recent works have shown that it is possible to automatically learn the data augmentation strategies (Lemley et al., 2017; Ratner et al., 2017). We hope that these insights encourage more research attention on data augmentation and that future work brings more sophisticated and effective data augmentation techniques, potentially applicable to different data modalities.
# REFERENCES
Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, and et al. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
Antreas Antoniou, Amos Storkey, and Harrison Edwards. Data augmentation generative adversarial networks. arXiv preprint arXiv:1711.04340, 2017.
Peter L Bartlett and Shahar Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002.
Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems, pp. 6240–6249, 2017.
Chris M Bishop. Training with noise is equivalent to tikhonov regularization. Neural computation, 7 (1):108–116, 1995.
Xavier Bouthillier, Kishore Konda, Pascal Vincent, and Roland Memisevic. Dropout as data augmentation. arXiv preprint arXiv:1506.08700, 2015.
Rich Caruana. Multitask learning. In Learning to learn, pp. 95–133. Springer, 1998.
Shuxiao Chen, Edgar Dobriban, and Jane H Lee. Invariance reduces variance: Understanding data augmentation in deep learning and beyond. arXiv preprint arXiv:1907.10905, 2019.
François Chollet et al. Keras. https://github.com/fchollet/keras, 2015.
Yann N Dauphin and Yoshua Bengio. Big neural networks waste capacity. In International Conference on Learning Representations, ICLR, arXiv:1301.3583, 2013.
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017a.
Terrance DeVries and Graham W Taylor. Dataset augmentation in feature space. In International Conference on Learning Representations, ICLR, arXiv:1702.05538, 2017b.
Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, JMLR, 11(Feb):625–660, 2010.
Federico Girosi, Michael Jones, and Tomaso Poggio. Regularization theory and neural networks architectures. Neural computation, 7(2):219–269, 1995.
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In JMLR W&CP: International Conference on Artificial Intelligence and Statistics, AISTATS, volume 9, pp. 249–256, 2010.
Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In JMLR W&CP: International Conference on Artificial Intelligence and Statistics, AISTATS, volume 15, pp. 315–323, 2011.
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
Ian J. Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron C. Courville, and Yoshua Bengio. Maxout networks. In International Conference on Machine Learning, ICML, pp. 1319–1327, 2013.
Benjamin Graham. Fractional max-pooling. arXiv preprint arXiv:1412.6071, 2014.
Hongyu Guo, Yongyi Mao, and Richong Zhang. Mixup as locally linear out-of-manifold regularization. arXiv preprint arXiv:1809.02499, 2018.
Stephen José Hanson and Lorien Y Pratt. Comparing biases for minimal network construction with back-propagation. In Advances in Neural Information Processing Systems, NIPS, pp. 177–185, 1989.
Søren Hauberg, Oren Freifeld, Anders Boesen Lindbo Larsen, John Fisher, and Lars Hansen. Dreaming more data: Class-dependent distributions over diffeomorphisms for learned data augmentation. In Artificial Intelligence and Statistics, pp. 342–350, 2016.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
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.
David P Helmbold and Philip M Long. Surprising properties of dropout in deep networks. The Journal of Machine Learning Research, 18(1):7284–7311, 2017.
Alex Hernández-García and Peter König. Further advantages of data augmentation on convolutional neural networks. In International Conference on Artificial Neural Networks, pp. 95–103. Springer, 2018a.
Alex Hernández-García and Peter König. Do deep nets really need weight decay and dropout? arXiv preprint arXiv:1802.07042, 2018b.
Alex Hernández-García, Johannes Mehrer, Nikolaus Kriegeskorte, Peter König, and Tim C. Kietzmann. Deep neural networks trained with heavier data augmentation learn features closer to representations in hIT. In Conference on Cognitive Computational Neuroscience, 2018.
Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European Conference on Computer Vision, pp. 646–661. Springer, 2016.
Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2261–2269. IEEE, 2017.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, ICML, pp. 448–456, 2015.
Navdeep Jaitly and Geoffrey E Hinton. Vocal tract length perturbation (vtlp) improves speech recognition. In Proc. ICML Workshop on Deep Learning for Audio, Speech and Language, pp. 625–660, 2013.
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, NIPS, pp. 1097–1105, 2012.
Jan Kukacka, Vladimir Golkov, and Daniel Cremers. Regularization for deep learning: A taxonomy. ˇ arXiv preprint arXiv:1710.10686, 2017.
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. arXiv preprint arXiv:1605.07648, 2016.
Yann LeCun, Bernhard E Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne E Hubbard, and Lawrence D Jackel. Handwritten digit recognition with a back-propagation network. In Advances in Neural Information Processing Systems, NIPS, pp. 396–404, 1990.
Joseph Lemley, Shabab Bazrafkan, and Peter Corcoran. Smart augmentation-learning an optimal data augmentation strategy. IEEE Access, 2017.
Xinghua Lu, Bin Zheng, Atulya Velivelli, and ChengXiang Zhai. Enhancing text categorization with semantic-enriched representation and training data augmentation. Journal of the American Medical Informatics Association, 13(5):526–535, 2006.
Wenlong Mou, Yuchen Zhou, Jun Gao, and Liwei Wang. Dropout training, data-dependent regularization, and generalization bounds. In International Conference on Machine Learning, pp. 3642–3650, 2018.
Klaus-Robert Müller. Regularization techniques to improve generalization. In Neural Networks: Tricks of the Trade, pp. 49–51. Springer, 2012.
Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. In International Conference on Learning Representations, ICLR, arXiv:1412.6614, 2014.
Roman Novak, Yasaman Bahri, Daniel A Abolafia, Jeffrey Pennington, and Jascha Sohl-Dickstein. Sensitivity and generalization in neural networks: an empirical study. In International Conference on Learning Representations, ICLR, arXiv:1802.08760, 2018.
Luis Perez and Jason Wang. The effectiveness of data augmentation in image classification using deep learning. arXiv preprint arXiv:1712.04621, 2017.
Shashank Rajput, Zhili Feng, Zachary Charles, Po-Ling Loh, and Dimitris Papailiopoulos. Does data augmentation lead to positive margin? arXiv preprint arXiv:1905.03177, 2019.
Alexander J Ratner, Henry R Ehrenberg, Zeshan Hussain, Jared Dunnmon, and Christopher Ré. Learning to compose domain-specific transformations for data augmentation. In Advances in Neural Information Processing Systems, NIPS, pp. 3239–3249, 2017.
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision, IJCV, 115 (3):211–252, 2015.
Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization? In Advances in Neural Information Processing Systems, pp. 2483–2493, 2018.
Patrice Simard, Bernard Victorri, Yann LeCun, and John Denker. Tangent prop-a formalism for specifying selected invariances in an adaptive network. In Advances in Neural Information Processing Systems, NIPS, pp. 895–903, 1992.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. In International Conference on Learning Representations, ICLR, arXiv:1412.6806, 2014.
Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, JMLR, 15(1):1929–1958, 2014.
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
Stefan Uhlich, Marcello Porcu, Franck Giron, Michael Enenkl, Thomas Kemp, Naoya Takahashi, and Yuki Mitsufuji. Improving music source separation based on deep neural networks through data augmentation and network blending. IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP, 2017.
V. N. Vapnik and A. Y. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Probab. and its Applications, 16(2):264–280, 1971.
Oriol Vinyals, Charles Blundell, Tim Lillicrap, koray kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, NIPS, pp. 3630–3638, 2016.
Stefan Wager, Sida Wang, and Percy S Liang. Dropout training as adaptive regularization. In Advances in neural information processing systems, pp. 351–359, 2013.
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference, BMVC, pp. 87.1–87.12, 2016.
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, ICLR, arXiv:1611.03530, 2017.
# A DETAILS OF NETWORK ARCHITECTURES
This appendix presents the details of the network architectures used in the main experiments: AllCNN, Wide Residual Network (WRN) and DenseNet. All-CNN is a relatively simple, small network with a few number of layers and parameters, WRN is deeper, has residual connections and many more parameters and DenseNet is densely connected and is much deeper, but parameter effective.
# A.1 ALL CONVOLUTIONAL NETWORK
All-CNN consists exclusively of convolutional layers with ReLU activation (Glorot et al., 2011), it is relatively shallow and has few parameters. For ImageNet, the network has 16 layers and 9.4 million parameters; for CIFAR, it has 12 layers and about 1.3 million parameters. In our experiments to compare the adaptability of data augmentation and explicit regularization to changes in the architecture, we also test a shallower version, with 9 layers and 374,000 parameters, and a deeper version, with 15 layers and 2.4 million parameters. The four architectures can be described as in Table 3, where $K \mathbf { C } D ( S )$ is a $D \times D$ convolutional layer with $K$ channels and stride $S$ , followed by batch normalization and a ReLU non-linearity. $N . C l .$ is the number of classes and Gl.Avg. refers to global average pooling. The CIFAR network is identical to the All-CNN-C architecture in the original paper, except for the introduction of the batch normalization layers. The ImageNet version also includes batch normalization layers and a stride of 2 instead of 4 in the first layer to compensate for the reduced input size (see below).
ImageNet 96C11(2)–96C1(1)–96C3(2)–256C5(1) –256C1(1)–256C3(2)–384C3(1) –384C1(1)–384C3(2)–1024C3(1) –1024C1(1)–N.Cl.C1(1) –Gl.Avg.–Softmax CIFAR 2×96C3(1)–96C3(2)–2×192C3(1) –192C3(2)–192C3(1)–192C1(1) –N.Cl.C1(1)–Gl.Avg.–Softmax Shallower 2×96C3(1)–96C3(2)–192C3(1) –192C1(1)–N.Cl.C1(1)–Gl.Avg.–Softmax Deeper $2 \times 9 6 \mathbf { C } 3 ( 1 ) { - } 9 6 \mathbf { C } 3 ( 2 ) { - } 2 { \times } 1 9 2 \mathbf { C } 3 ( 1 )$ ) $- 1 9 2 \mathbf { C } 3 ( 2 ) - 2 \times 1 9 2 \mathbf { C } 3 ( 1 ) - 1 9 2 \mathbf { C } 3 ( 2 )$ –192C3(1)–192C1(1) –N.Cl.C1(1)–Gl.Avg.–Softmax
Importantly, we keep the same training parameters as in the original paper in the cases they are reported. Specifically, the All-CNN networks are trained using stochastic gradient descent, with fixed Nesterov momentum 0.9, learning rate of 0.01 and decay factor of 0.1. The batch size for the experiments on ImageNet is 64 and we train during 25 epochs decaying the learning rate at epochs 10 and 20. On CIFAR, the batch size is 128, we train for 350 epochs and decay the learning rate at epochs 200, 250 and 300. The kernel parameters are initialized according to the Xavier uniform initialization (Glorot & Bengio, 2010).
# A.2 WIDE RESIDUAL NETWORK
WRN is a modification of ResNet (He et al., 2016) that achieves better performance with fewer layers, but more units per layer. Here we choose for our experiments the WRN-28-10 version (28 layers and about $3 6 . 5 \mathrm { ~ M ~ }$ parameters), which is reported to achieve the best results on CIFAR. It has the following architecture:
where $K \mathbf { \mathbf { \mathbf { k } } }$ is a residual block with residual function BN–ReLU–KC3(1)–BN–ReLU–KC 3(1). BN is batch normalization, Avg.(8) is spatial average pooling of size 8 and FC is a fully connected layer. On ImageNet, the stride of the first convolution is 2. The stride of the first convolution within the residual blocks is 1 except in the first block of the series of 4, where it is set to 2 in order to subsample the feature maps.
Similarly, we keep the training parameters of the original paper: we train with SGD, with fixed Nesterov momentum 0.9 and learning rate of 0.1. On ImageNet, the learning rate is decayed by 0.2 at epochs 8 and 15 and we train for a total of 20 epochs with batch size 32. On CIFAR, we train with a batch size of 128 during 200 epochs and decay the learning rate at epochs 60, 120 and 160. The kernel parameters are initialized according to the He normal initialization (He et al., 2015).
# A.3 DENSENET
The main characteristic of DenseNet (Huang et al., 2017) is that the architecture is arranged into blocks whose layers are connected to all the layers below, forming a dense graph of connections, which permits training very deep architectures with fewer parameters than, for instance, ResNet. Here, we use a network with bottleneck compression rate $\theta = 0 . 5$ (DenseNet-BC), growth rate $k = 1 2$ and 16 layers in each of the three blocks. The model has nearly 0.8 million parameters. The specific architecture can be descried as follows:
where $\mathrm { D B } ( c )$ is a dense block, that is a concatenation of $c$ convolutional blocks. Each convolutional block is of a set of layers whose output is concatenated with the input to form the input of the next convolutional block. A convolutional block with bottleneck structure has the following layers:
TB is a transition block, which downsamples the size of the feature maps, formed by the following layers:
Like with All-CNN and WRN, we keep the training hyper-parameters of the original paper. On the CIFAR data sets, we train with SGD, with fixed Nesterov momentum 0.9 and learning rate of 0.1, decayed by 0.1 on epochs 150 and 200 and training for a total of 300 epochs. The batch size is 64 and the are initialized with He initialization.
# B DETAILS OF THE HEAVIER DATA AUGMENTATION SCHEME
In this appendix we present the details of the heavier data augmentation scheme, introduced in Section 3.2:
• Affine transformations: $\left[ \begin{array} { c } { x ^ { \prime } } \\ { y ^ { \prime } } \\ { 1 } \end{array} \right] = \left[ \begin{array} { c c c } { f _ { h } z _ { x } \cos ( \theta ) } & { - z _ { y } \sin ( \theta + \phi ) } & { t _ { x } } \\ { z _ { x } \sin ( \theta ) } & { z _ { y } \cos ( \theta + \phi ) } & { t _ { y } } \\ { 0 } & { 0 } & { 1 } \end{array} \right] \left[ \begin{array} { c } { x } \\ { y } \\ { 1 } \end{array} \right]$ • Contrast adjustment: $x ^ { \prime } = \gamma ( x - \overline { { x } } ) + \overline { { x } }$ • Brightness adjustment: $x ^ { \prime } = x + \delta$
# C DETAILED AND EXTENDED EXPERIMENTAL RESULTS
This appendix details the results of the main experiments shown in Figures 1, 2 and 3 and provides the results of many other experiments not presented above in order not to clutter the visualization. Some of these results are the top-1 accuracy on ImageNet, the results of the models trained with dropout, but without weight decay; and the results of training with $80 \%$ and $1 \%$ of the data.
Table 4: Description and range of possible values of the parameters used for the heavier augmentation. $B ( p )$ denotes a Bernoulli distribution and $\textstyle { \mathcal { U } } ( a , b )$ a uniform distribution.
<table><tr><td>Parameter</td><td>Description</td><td>Range</td></tr><tr><td>fh</td><td>Horiz. flip</td><td>1- 2B(0.5)</td></tr><tr><td>tx</td><td>Horiz. translation</td><td>u(-0.1,0.1)</td></tr><tr><td>ty</td><td>Vert. translation</td><td>u(-0.1,0.1)</td></tr><tr><td>2x</td><td>Horiz. scale</td><td>U(0.85,1.15)</td></tr><tr><td>Zy</td><td>Vert. scale</td><td>U(0.85,1.15)</td></tr><tr><td>0</td><td>Rotation angle</td><td>U(-22.5°,22.5°)</td></tr><tr><td>?</td><td>Shear angle</td><td>u(-0.15,0.15)</td></tr><tr><td>?</td><td>Contrast</td><td>(0.5,1.5)</td></tr><tr><td>8</td><td>Brightness</td><td>U(-0.25,0.25)</td></tr></table>
Additionally, for many experiments we also train a version of the network without batch normalization. These results are provided within brackets in the tables. Note that the original All-CNN results published by Springenberg et al. (2014) did not include batch normalization. In the case of WRN, we remove all batch normalization layers except the top-most one, before the spatial average pooling, since otherwise many models would not converge.
Table 5: Test accuracy of All-CNN and WRN, comparing the performance with and without explicit regularizers and the different augmentation schemes. Results within brackets show the performance of the models without batch normalization
<table><tr><td>Network</td><td>WD</td><td>Dropout</td><td>Aug.</td><td>CIFAR-10</td><td>CIFAR-100</td><td>Acc. ImageNet</td></tr><tr><td rowspan="8">All-CNN</td><td>yes</td><td>yes</td><td>no</td><td>90.04 (88.35)</td><td>66.50 (60.54)</td><td>58.09</td></tr><tr><td>yes</td><td>yes</td><td>light</td><td>93.26 (91.97)</td><td>70.85 (65.57)</td><td>63.35</td></tr><tr><td>yes</td><td>yes</td><td>heavier</td><td>93.08 (92.44)</td><td>70.59 (68.62)</td><td>60.15</td></tr><tr><td>no</td><td>yes</td><td>no</td><td>77.99 (87.59)</td><td>52.39 (60.96)</td><td></td></tr><tr><td>no</td><td>yes</td><td>light</td><td>77.20 (92.01)</td><td>69.71 (68.01)</td><td></td></tr><tr><td>no</td><td>yes</td><td>heavier</td><td>88.29 (92.18)</td><td>70.56 (68.40)</td><td></td></tr><tr><td>no</td><td>no</td><td>no</td><td>84.53 (71.98)</td><td>57.99 (39.03)</td><td>56.53</td></tr><tr><td>no</td><td>no</td><td>light</td><td>93.26 (90.10)</td><td>69.26 (63.00)</td><td>63.79</td></tr><tr><td rowspan="8">WRN</td><td>no</td><td>no</td><td>heavier</td><td>93.55 (91.48)</td><td>71.25 (71.46)</td><td>61.37</td></tr><tr><td>yes</td><td>yes</td><td>no</td><td>91.44 (89.30)</td><td>71.67 (67.42)</td><td>54.67</td></tr><tr><td>yes</td><td>yes</td><td>light</td><td>95.01 ( 1(93.48)</td><td>77.58 (74.23)</td><td>68.84</td></tr><tr><td>yes</td><td>yes</td><td>heavier</td><td>95.60 (94.38)</td><td>76.96 (74.79)</td><td>66.82</td></tr><tr><td>no</td><td>yes</td><td>no</td><td>91.47 (89.38)</td><td>71.31 (66.85)</td><td></td></tr><tr><td>no</td><td>yes</td><td>light</td><td>94.76 (93.52)</td><td>77.42 (74.62)</td><td></td></tr><tr><td>no</td><td>yes</td><td>heavier</td><td>95.58 (94.52)</td><td>77.47 (73.96)</td><td></td></tr><tr><td>no</td><td>no</td><td>no</td><td>89.56 (85.45)</td><td>68.16 (59.90)</td><td>61.29</td></tr><tr><td></td><td>no</td><td>no</td><td>light</td><td>94.71 (93.69)</td><td>77.08 (75.27)</td><td>69.80</td></tr><tr><td></td><td>no</td><td>no</td><td>heavier</td><td>95.47 (94.95)</td><td>77.30 (75.69)</td><td>69.30</td></tr></table>
An important observation from Table 5 is that the interaction of weight decay and dropout is not always consistent, since in some cases better results can be obtained with both explicit regularizers active and in other cases, only dropout achieves better generalization. In contrast, the effect of data augmentation seems to be consistent: just some light augmentation achieves much better results than training only with the original data set and performing heavier augmentation almost always further improves the test accuracy, without the need for explicit regularization.
Not surprisingly, batch normalization also contributes to improve the generalization of All-CNN and it seems to combine well with data augmentation. On the contrary, when combined with explicit regularization the results are interestingly not consistent in the case of All-CNN: it seems to improve the generalization of the model trained with both weight decay and dropout, but it drastically reduces the performance with only dropout, in the case of CIFAR-10 and CIFAR-100 without augmentation.
A probable explanation is, again, that the regularization hyperparameters would need to be readjusted with a change of the architecture.
Furthermore, it seems that the gap between the performance of the models trained with and without batch normalization is smaller when they are trained without explicit regularization and when they include heavier data augmentation. This can be observed in Table 5, as well as in Table 6, which contains the results of the models trained with fewer examples. It is important to note as well the benefits of batch normalization for obtaining better results when training with fewer examples. However, it is surprising that there is only a small drop in the performance of WRN— $9 5 . 4 7 ~ \%$ to $9 4 . 9 5 \%$ without regularization— from removing the batch normalization layers of the residual blocks, given that they were identified as key components of ResNet (He et al., 2016; Zagoruyko & Komodakis, 2016).
Table 6: Test accuracy of All-CNN and WRN when training with only $80 \%$ , $50 \%$ , $10 \%$ and $1 \%$ of the available examples. Results within brackets correspond to the models without batch normalization
<table><tr><td colspan="2">Pct. Data Expl. Reg.</td><td>Aug. scheme</td><td colspan="2">Test CIFAR-10</td><td colspan="2">Test CIFAR-100</td></tr><tr><td rowspan="7">80 %</td><td></td><td></td><td>All-CNN</td><td>WRN</td><td>All-CNN</td><td>WRN</td></tr><tr><td>yes</td><td>no</td><td>89.41 (86.61)</td><td>90.27</td><td>63.93 (52.51)</td><td>70.41</td></tr><tr><td>yes</td><td>light</td><td>92.20 (91.25)</td><td>94.07</td><td>67.63 (63.24)</td><td>75.66</td></tr><tr><td>yes</td><td>heavier</td><td>92.83 (91.42)</td><td>94.57</td><td>68.01 (65.89)</td><td>75.51</td></tr><tr><td>no</td><td>no</td><td>83.04 (75.00)</td><td>88.98</td><td>55.78 (35.95)</td><td>66.10</td></tr><tr><td>no</td><td>light</td><td>92.25 (88.75)</td><td>93.97</td><td>69.05 (56.81)</td><td>75.07</td></tr><tr><td>no</td><td>heavier</td><td>92.80 (90.55)</td><td>94.84</td><td>69.40 (63.57)</td><td>75.38</td></tr><tr><td rowspan="6">50 %</td><td>yes</td><td>no</td><td>85.88 (82.33)</td><td>86.96</td><td>58.24 (44.94)</td><td>63.60</td></tr><tr><td>yes</td><td>light</td><td>90.30 (87.37)</td><td>92.65</td><td>61.03 (54.68)</td><td>70.83</td></tr><tr><td>yes</td><td>heavier</td><td>90.09 (88.94)</td><td>92.86</td><td>63.25 (57.91)</td><td>70.33</td></tr><tr><td>no</td><td>no</td><td>78.61 (69.46)</td><td>85.56</td><td>48.62 (31.81)</td><td>60.64</td></tr><tr><td>no</td><td>light</td><td>90.21 (84.38)</td><td>91.87</td><td>62.83 (47.84)</td><td>69.97</td></tr><tr><td>no</td><td>heavier</td><td>90.76 (87.44)</td><td>92.77</td><td>64.41 ( (55.27)</td><td>70.72</td></tr><tr><td rowspan="6">10 %</td><td>yes</td><td>no</td><td>67.19 (61.61)</td><td>70.73</td><td>33.77 (19.79)</td><td>34.11</td></tr><tr><td>yes</td><td>light</td><td>76.03 (69.18)</td><td>76.00</td><td>38.51 (22.79)</td><td>36.65</td></tr><tr><td>yes</td><td>heavier</td><td>78.69 (64.14)</td><td>78.10</td><td>38.34 (26.29)</td><td>38.93</td></tr><tr><td>no</td><td>no</td><td>60.97 (41.07)</td><td>60.39</td><td>26.05 (17.55)</td><td>23.65</td></tr><tr><td>no</td><td>light</td><td>78.29 (67.65)</td><td>79.19</td><td>37.84 (24.34)</td><td>39.24</td></tr><tr><td>no</td><td>heavier</td><td>79.87 (70.64)</td><td>80.29</td><td>39.85 (26.31)</td><td>41.44</td></tr><tr><td rowspan="6">1%</td><td>yes</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td>yes</td><td></td><td>27.53 (29.90)</td><td>33.45</td><td>9.16 (3.60)</td><td>7.47</td></tr><tr><td>yes</td><td>light heavier</td><td>37.18 (26.85)</td><td>34.13 41.02</td><td>9.64 (3.65) 9.14 (2.52)</td><td>7.50 8.37</td></tr><tr><td>no</td><td>no</td><td>42.73 (26.87) 38.89 (35.68)</td><td>38.63</td><td>9.50 (5.51)</td><td>9.47</td></tr><tr><td>no</td><td>light</td><td>44.35 (29.29)</td><td>43.84</td><td>9.87 (5.36)</td><td>9.91</td></tr><tr><td>no</td><td>heavier</td><td>47.60 (33.72)</td><td>47.14</td><td>11.45 (3.57)</td><td>11.03</td></tr></table>
The results in Table 6 clearly support the conclusion presented in Section 4.2: data augmentation alone better resists the lack of training data compared to explicit regularizers. Already with $80 \%$ and $50 \%$ of the data better results are obtained in some cases, but the differences become much bigger when training with only $10 \%$ and $1 \%$ of the available data. It seems that explicit regularization prevents the model from both fitting the data and generalizing well, whereas data augmentation provides useful transformed examples. Interestingly, with only $1 \%$ of the data, even without data augmentation the models without explicit regularization perform better.
The same effect can be observed in Table 7, where both the shallower and deeper versions of AllCNN perform much worse when trained with explicit regularization, even when trained without data augmentation. This is another piece of evidence that explicit regularization needs to be used very carefully, it requires a proper tuning of the hyperparameters and is not always beneficial.
Table 7: Test accuracy of the shallower and deeper versions of All-CNN on CIFAR-10 and CIFAR-100. Results in parentheses show the difference with respect to the original model.
<table><tr><td>Expl. Reg.</td><td>Aug.</td><td colspan="2">Test CIFAR-10</td><td colspan="2">Test CIFAR-100</td></tr><tr><td></td><td></td><td>Shallower</td><td>Deeper</td><td>Shallower</td><td>Deeper</td></tr><tr><td>yes</td><td>no</td><td>76.45 (-13.59)</td><td>86.26 (-3.78)</td><td>51.31 (-9.23)</td><td>49.06 (-11.48)</td></tr><tr><td>yes</td><td>light</td><td>82.02 (-11.24)</td><td>85.04 (-8.22)</td><td>56.81 (-8.76)</td><td>52.03 (-13.54)</td></tr><tr><td>yes</td><td>heavier</td><td>86.66 (-6.42)</td><td>88.46 (-4.62)</td><td>58.64 (-9.98)</td><td>51.78 (-16.84)</td></tr><tr><td>no</td><td>no</td><td>85.22 (+0.69)</td><td>83.30 (-1.23)</td><td>58.95 (+0.96)</td><td>54.22 (-3.77)</td></tr><tr><td>no</td><td>light</td><td>90.02 (-3.24)</td><td>93.46 (+0.20)</td><td>65.51 (-3.75)</td><td>72.16 (+2.90)</td></tr><tr><td>no</td><td>heavier</td><td>90.34 (-3.21)</td><td>94.19 (+0.64)</td><td>65.87 (-5.38)</td><td>73.30 (+2.35)</td></tr></table>
# D NORM OF THE WEIGHT MATRIX
In this appendix we provide the computations of the Frobenius norm of the weight matrices of the models trained with different levels of explicit regularization and data augmentation, as a rough estimation of the complexity of the learned models. Table 8 shows the Frobenius norm of the weight matrices of the models trained with different levels of explicit regularization and data augmentation. The clearest conclusion is that heavier data augmentation seems to yield solutions with larger norm. This is always true except in some All-CNN models trained without batch normalization. Another observation is that, as expected, weight decay constrains the norm of the learned function. Besides, the models trained without batch normalization exhibit smaller differences between different levels of regularization and augmentation and, in the case of All-CNN, less consistency.
Table 8: Frobenius norm of the weight matrices learned by the networks All-CNN and WRN on CIFAR-10 and CIFAR-100, trained with and without explicit regularizers and the different augmentation schemes. Norms within brackets correspond to the models without batch normalization
<table><tr><td>WD</td><td>Dropout</td><td>Aug.</td><td colspan="2">Norm CIFAR-10</td><td colspan="2">Norm CIFAR-100</td></tr><tr><td></td><td></td><td></td><td>All-CNN</td><td>WRN</td><td>All-CNN</td><td>WRN</td></tr><tr><td>yes</td><td>yes</td><td>no</td><td>48.7 (64.9)</td><td>101.4 (122.6)</td><td>76.5 (97.9)</td><td>134.8 (126.5)</td></tr><tr><td>yes</td><td>yes</td><td>light</td><td>52.7 (63.2)</td><td>106.1 (123.9)</td><td>77.6 (86.8)</td><td>140.8 (129.3)</td></tr><tr><td>yes</td><td>yes</td><td>heavier</td><td>57.6 (62.8)</td><td>119.3 (125.3)</td><td>78.1 (83.1)</td><td>164.2 (132.5)</td></tr><tr><td>no</td><td>yes</td><td>no</td><td>52.4 (70.5)</td><td>153.3 (122.5)</td><td>79.7 (103.3)</td><td>185.1 (126.5)</td></tr><tr><td>no</td><td>yes</td><td>light</td><td>57.0 (67.9)</td><td>160.6 (123.9)</td><td>83.6 (93.0)</td><td>199.0 (129.4)</td></tr><tr><td>no</td><td>yes</td><td>heavier</td><td>62.8 (67.5)</td><td>175.1 (125.2)</td><td>84.0 (88.0)</td><td>225.4 (132.5)</td></tr><tr><td>no</td><td>no</td><td>no</td><td>37.3 (63.7)</td><td>139.0 (120.4)</td><td>47.6 (102.7)</td><td>157.9 (122.0)</td></tr><tr><td>no</td><td>no</td><td>light</td><td>47.0 (69.5)</td><td>153.6 (123.2)</td><td>80.0 (108.9)</td><td>187.0 (127.2)</td></tr><tr><td>no</td><td>no</td><td>heavier</td><td>62.0 (71.7)</td><td>170.4 (125.4)</td><td>91.7 (91.7)</td><td>217.6 (132.9)</td></tr></table>
One of the relevant results presented in this paper is the poor performance of the regularized models on the shallower and deeper versions of All-CNN, compared to the models without explicit regularization (see Table 7). One hypothesis is that the amount of regularization is not properly adjusted through the hyperparameters. This could be reflected in the norm of the learned weights, shown in Table 9. However, the norm alone does not seem to fully explain the large performance differences between the different models. Finding the exact reasons why the regularized models not able to generalize well might require a much thorough analysis and we leave it as future work.
# E ON THE TAXONOMY OF REGULARIZATION
Although it is out of the scope of this paper to elaborated on the taxonomy of regularization techniques for deep neural networks, an important contribution of this work is providing definitions of explicit and implicit regularization, which have been used ambiguously in the literature before. It is therefore worth mentioning here some of the previous works that have used these terms and to point to literature that has specifically elaborated on the regularization taxonomy or proposed other related terms.
Table 9: Frobenius norm of the weight matrices learned by the shallower and deeper versions of the All-CNN network on CIFAR-10 and CIFAR-100.
<table><tr><td>Explicit Reg.</td><td>Aug. s .scheme</td><td colspan="2">Norm CIFAR-10</td><td colspan="2">Norm CIFAR-100</td></tr><tr><td></td><td></td><td>Shallower</td><td>Deeper</td><td>Shallower</td><td>Deeper</td></tr><tr><td>yes</td><td>no</td><td>47.9</td><td>62.3</td><td>68.9</td><td>92.1</td></tr><tr><td>yes</td><td>light</td><td>49.7</td><td>66.5</td><td>67.1</td><td>95.7</td></tr><tr><td>yes</td><td>heavier</td><td>51.9</td><td>71.5</td><td>66.2</td><td>96.9</td></tr><tr><td>no</td><td>no</td><td>34.8</td><td>45.4</td><td>64.7</td><td>53.4</td></tr><tr><td>no</td><td>light</td><td>45.6</td><td>57.3</td><td>68.8</td><td>77.3</td></tr><tr><td>no</td><td>heavier</td><td>53.1</td><td>70.7</td><td>68.3</td><td>97.5</td></tr></table>
Neyshabur et al. (2014) observed that the size of neural networks could not explain and control by itself the effective capacity of neural networks and proposed that other elements should implicitly regularize the models. However, no definitions or clear distinction between explicit and implicit regularization was provided. Later, Zhang et al. (2017) compared different regularization techniques and mentioned the role of implicit regularization, but did not provide definitions either, and, importantly, they considered data augmentation an explicit form of regularization. We have argued against that view throughout this paper, especially in Sections 2 and 6.1.
An extensive review of the taxonomy of regularization techniques was carried out by Kukacka et al. ˇ (2017). Although no distinction is made between explicit and implicit regularization, they define the class regularization via optimization, which is somehow related to implicit regularization. However, regularization via optimization is more specific than our definition and data augmentation, among others, would not fall into that category.
Recently, Guo et al. (2018) provided a distinction between data-independent and data-dependent regularization. They define data-independent regularization as those techniques that impose certain constraint on the hypothesis set, thus constraining the optimization problem. Examples are weight decay and dropout. We believe this is closely related to our definition of explicit regularization. Then, they define data-dependent regularization as those techniques that make assumptions on the hypothesis set with respect to the training data, as is the case of data augmentation.
While we acknowledge the usefulness of such taxonomy, we believe the division between dataindependent and dependent regularization leaves some ambiguity about other techniques, such as batch-normalization, which neither imposes an explicit constraint on H nor on the training data. The taxonomy of explicit vs. implicit regularization is however complete, since implicit regularization refers to any regularization effect that does not come from explicit (or data-independent) techniques.
Finally, we argue it would be useful to distinguish between domain-specific, perceptually-motivated data augmentation and other kinds of data-dependent regularization. Data augmentation ultimately aims at creating new examples that could be plausible transformations of the real-world objects. In other words, the augmented samples should be no different in nature than the available data. In statistical terms, they should belong to the same underlying probability distribution. In contrast, one can think of data manipulations that would not mimic any plausible transformation of the data, which still can improve generalization and thus fall into the category of data-dependent regularization (and implicit regularization). One example is mixup, which is the subject of study of Guo et al. (2018).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398# BACKPLAY: ‘MAN MUSS IMMER UMKEHREN’
Cinjon Resnick∗ NYU cinjon@nyu.edu
Roberta Raileanu∗ NYU rr3009@nyu.edu
Sanyam Kapoor NYU sanyam@nyu.edu
Alexander Peysakhovich FAIR alexpeys@fb.com
Kyunghyun Cho NYU, FAIR kyunghyun.cho@nyu.edu Joan Bruna NYU, FAIR bruna@cims.nyu.edu
# ABSTRACT
Model-free reinforcement learning (RL) requires a large number of trials to learn a good policy, especially in environments with sparse rewards. We explore a method to improve the sample efficiency when we have access to demonstrations. Our approach, Backplay, uses a single demonstration to construct a curriculum for a given task. Rather than starting each training episode in the environment’s fixed initial state, we start the agent near the end of the demonstration and move the starting point backwards during the course of training until we reach the initial state. Our contributions are that we analytically characterize the types of environments where Backplay can improve training speed, demonstrate the effectiveness of Backplay both in large grid worlds and a complex four player zero-sum game (Pommerman), and show that Backplay compares favorably to other competitive methods known to improve sample efficiency. This includes reward shaping, behavioral cloning, and reverse curriculum generation.
# 1 INTRODUCTION
An important goal of AI research is to construct agents that can learn well in new environments (Levine et al., 2016). An increasingly popular paradigm for this task is deep reinforcement learning (deep RL, Silver et al. (2016); Moravcík et al. (2017); Silver et al. (2017)). However, training an RL agent can take a very long time, particularly in environments with sparse rewards. In these settings, the agent typically requires a large number of episodes to stumble upon positive rewards and learn even a moderately effective policy that can then be refined. This is often resolved via hand-engineering a dense reward function. Such reward shaping, while effective, can also change the set of optimal policies and have unintended side effects $\mathrm { N g }$ et al., 1999; Clark & Amodei, 2016).
We consider an alternative technique for accelerating RL in sparse reward settings. The idea is to create a curriculum for the agent via reversing a single trajectory (i.e. state sequence) of reasonably good, but not necessarily optimal, behavior. We start our agent at the end of a demonstration and let it learn a policy in this easier setup. We then move the starting point backward until the agent is training only on the initial state of the task. We call this technique Backplay.
Our contributions are threefold:
1. We characterize analytically and qualitatively which environments Backplay will aid. 2. We demonstrate Backplay’s effectiveness on both a grid world task (to gain intuition) as well as the four player stochastic zero-sum game Pommerman (MultiAgentLearning, 2018). 3. We empirically show that Backplay compares favorably to other methods that improve sample complexity.
Besides requiring vastly fewer number of samples to learn a good policy, an agent trained with Backplay can outperform its demonstrator and even learn an optimal policy following a sub-optimal demonstration. Our experiments further show Backplay’s strong performance relative to reward shaping (involves hand tuning reward functions), behavioral cloning (not intended for use with sub-optimal experts), and other forms of automatic curriculum generation (Florensa et al. (2017), requires a reversable environment).
# 2 RELATED WORK
The most related work to ours is a blog post describing a method similar to Backplay used to obtain state-of-theart performance on the challenging Atari game Montezuma’s Revenge (Salimans & Chen, 2018). This work was independent of and concurrent to our own. In addition to reporting results on a different, complex stochastic multi-agent environment, we provide an analytic characterization of the method as well as an in depth discussion of what kinds of environments a practitioner can expect Backplay to out or underperform other existing methods.
 Figure 1. Backplay: We first collect a demonstration, from which we build a curriculum over the states. We then sample a state according to that curriculum and initialize our agent accordingly.
A popular method for improving RL with access to expert demonstrations is behavioral cloning/imitation learning. These methods explicitly encourage the learned policy to mimic an expert policy (Bain & Sommut, 1999; Ross et al., 2011; Daumé et al., 2009; Zhang & Cho, 2016; Laskey et al., 2016; Nair et al., 2017; Hester et al., 2017; Ho & Ermon, 2016; Aytar et al., 2018; Lerer & Peysakhovich, 2018; Peng et al., 2018). Imitation learning requires access to both state and expert actions (whereas Backplay only requires states) and is designed to copy an expert, thus it cannot, without further adjustments (e.g. as proposed by Gao et al. (2018)), surpass a suboptimal expert. We discuss the pros and cons of an imitation learning $^ +$ adjustment vs. a Backplay-based approach in the main analysis section.
Other algorithms (Ranzato et al., 2015; Li et al., 2016; Das et al., 2017a;b), primarily in dialog, use a Backplay-like curriculum, albeit they utilize behavioral cloning for the first part of the trajectory. This is a major difference as we show that for many classes of problems, we only need to change the initial state distribution and do not see any gains from warm-starting with imitation learning. Backplay is more similar to Conservative Policy Iteration (Kakade & Langford, 2002), a theoretical paper which presents an algorithm designed to operate with an explicit restart distribution.
Also related to Backplay is the method of automatic reverse curriculum generation Florensa et al. (2017). These approaches assumes that the final goal state is known and that the environment is both resettable and reversible. The curricula are generated by taking random walks in the state space to generate starting states or by taking random actions starting at the goal state McAleer et al. (2018). These methods do not require an explicit ‘good enough’ demonstration as Backplay does. However, they require the environment to be reversible, an assumption that doesn’t hold in many realistic tasks such as a robot manipulating breakable objects or complex video games such as Starcraft. In addition, they may fare poorly when random walks reach parts of the state space that are not actually relevant for learning a good policy. Thus, whether a practitioner wants to generate curricula from a trajectory or a random walk depends on the environment’s properties. We discuss this in more detail in our analysis section and show empirical results suggesting that Backplay is superior.
Hosu & Rebedea (2016) use uniformly random states of an expert demonstration as starting states for a policy. Like Backplay, they show that using a single loss function to learn a policy from both demonstrations and rewards can outperform the demonstrator and is robust to sub-optimal demonstrations. However, they do not impose a curriculum over the demonstration and are equivalent to the Uniform baseline in our experiments.
Zhu et al. (2018) use a curriculum but manually tune it for each ‘stage’ of the environment. Within each stage, they use what we call Uniform training, which fails in our most challenging environments.
Goyal et al. (2018) and Edwards et al. (2018) simultaneously proposed the use of a learned backtracking model to generate traces that lead to high value states. Their methods rely on either having the agent visit high reward states or learning a model of the environment capable of generating the states. Both of these are challenging in environments in which the dynamics near starting states are very different from those near goal states.
Finally, Ivanovic et al. (2018) use a known (approximate) dynamics model to create a backwards curriculum for continuous control tasks. Their approach requires a physical prior which is not always available and often not applicable in multi-agent scenarios. In contrast, Backplay automatically creates a curriculum fit for any resettable environment with accompanying demonstrations.
# 3 BACKPLAY
Consider the standard formalism of a single agent Markov Decision Process (MDP) defined by a set of states $s$ , a set of actions $\mathcal { A }$ , and a transition function $\mathcal { T } : \mathcal { S } \times \mathcal { A } \mathcal { S }$ which gives the probability distribution of the next state given a current state and action. If $\mathcal { P } ( A )$ denotes the space of probability distributions over actions, the agent chooses actions by sampling from a stochastic policy $\pi : { \mathcal { S } } { \mathcal { P } } ( { \mathcal { A } } )$ , and receives reward $r : S \times \mathcal { A } \mathbb { R }$ at every time step. The agent’s goal is to construct a policy which minimizes its discounted expected return $\begin{array} { r } { R _ { t } = \bar { \mathbb { E } } \left[ \sum _ { k = 0 } ^ { \infty } \bar { \gamma } ^ { k } r _ { t + k + 1 } \right] } \end{array}$ where $r _ { t }$ is the reward at time $t$ and $\gamma \in [ 0 , 1 ]$ is the discount factor, and the expectation is taken with respect to both the policy and the environment.
The final component of an MDP is the distribution of initial starting states $s _ { 0 }$ . The key idea in demonstration which reaches a sequence of states Backplay is that we do not initialize the MDP in only a fixed $\{ s _ { 0 } ^ { \dot { d } } , s _ { 1 } ^ { d } , \ldots , s _ { T } ^ { d } \}$ $s _ { 0 }$ . Instead, we assume access to a . For each training episode, we uniformly sample starting states from the sub-sequence $\{ s _ { T - k } ^ { d } , s _ { T - k + 1 } ^ { d } , . . . , s _ { T - j } ^ { d } \}$ for some window $[ j , k ]$ . Note that this training regime requires the ability to reset the environment to any state. As training continues, we ‘advance’ the window according to a curriculum by increasing the values of $j$ and $k$ until we are training on the initial state in every episode $( j = k = T )$ ). In this manner, our hyperparameters for Backplay are the windows and the training epochs at which we advance them.
# 3.1 QUANTITATIVE ANALYSIS
Next, we consider a simple environment in which we can analytically show that Backplay will improve the sample-efficiency of RL training.
Consider a connected, undirected graph $G = ( V , E )$ . An agent is placed at a fixed node $v _ { 0 } \in V$ and moves to neighboring nodes at a negative reward of $- 1$ for each step. Its goal is to reach a target node $v _ { * } \in V$ , terminating the episode. This corresponds to an MDP $\overset { \cdot } { \mathcal { M } } = \overset { \cdot } { ( } S , \overset { \cdot } { \mathcal { A } } , P , R )$ with state space $s \sim V$ , action space $A \sim E$ , deterministic transition kernel corresponding to
$$P ( s _ { t + 1 } = j \mid s _ { t } = i , a _ { t } = ( l , k ) ) = \delta ( j = k ) \delta ( l = i ) + \delta ( j = i ) \delta ( l \neq i )$$
and uniform reward $R ( s _ { t } , a _ { t } ) = - 1$ for $s _ { t + 1 } \neq v _ { * }$ . Assume that $\pi$ is a fixed policy on $\mathcal { M }$ , such that the underlying Markov chain is irreducible and aperiodic:
$$K _ { \pi } ( s ^ { \prime } , s ) = \sum _ { a \in \cal { A } } P ( s _ { t + 1 } = s ^ { \prime } \mid s _ { t } = s , a _ { t } = a ) \pi ( a \mid s )$$
$K _ { \pi }$ has a single absorbing state at $s = s _ { * } : = v _ { * }$ . Our goal is to estimate the value function of this policy, equivalent to the expected first-passage time of the Markov chain $K _ { \pi }$ from $s _ { 0 } = s$ to $s _ { * }$ :
$$V _ { \pi } ( s ) = \mathbb { E } \tau ( s , s _ { * } ) = \mathbb { E } \operatorname* { m i n } \{ j \geq 0 \ ; \ s . t . s _ { j } = s _ { * } , s _ { 0 } = s , s _ { i + 1 } \sim K _ { \pi } ( \cdot , s _ { i } ) \} .$$
We consider a special tractable case where the value function can be well approximated by looking at the distance of a state from the goal state. Formally:
Assumption 1. For all $\theta$ $\begin{array} { r } { \mathrm { ~ , ~ } V _ { \theta } ( s ) = V _ { \theta } ( s ^ { \prime } ) \ w h e n e \nu e r d i s t _ { G } ( s ^ { \prime } , s _ { \ast } ) = d i s t _ { G } ( s , s _ { \ast } ) . } \end{array}$
We wish to analyze the process which is the projection of our Markov policy $\pi$ only in terms of the distance $z _ { t }$ . However, now the transition probabilities will not only be a function of only $z _ { t }$ and so
this projection will be non-Markovian. Its Markov approximation $\bar { z } _ { t }$ is defined as the Markov chain $\overline { { K } }$ given by the expected transition probabilities
$$\begin{array} { r c l } { { \mathrm { P r } ( \bar { z } _ { t + 1 } = l - 1 | \bar { z } _ { t } = l ) } } & { { = } } & { { \alpha _ { l } : = \mathrm { P r } _ { \mu } ( z _ { t + 1 } = l - 1 | z _ { t } = l ) , } } \\ { { \mathrm { P r } ( \bar { z } _ { t + 1 } = l | \bar { z } _ { t } = l ) } } & { { = } } & { { \beta _ { l } : = \mathrm { P r } _ { \mu } ( z _ { t + 1 } = l | z _ { t } = l ) , l = 0 \ldots M } } \end{array}$$
and thus Pr(¯zt+1 = l + 1|z¯ $\ L _ { t } = l ) = 1 - \alpha _ { l } - \beta _ { l } = \operatorname* { P r } _ { \mu } ( z _ { t + 1 } = l + 1 \mid z _ { t } = l$ ) under the stationary distribution $\mu$ of $K _ { \pi }$ .
Assumption 2. The projected process is well described by its Markovian approximation.
Though these assumptions are relatively strong, they makes the analysis of Backplay in this graph complex but analytically tractable. Given a demonstration $\mathbf { d } = ( d _ { 0 } = s _ { 0 } , \ldots , d _ { L } = { \dot { s } } _ { * } )$ , $d _ { l } \in S$ we will perform Backplay
Theorem 1. When assumptions 1 and 2 hold, the sample complexity gains from using Backplay rather than standard RL are exponential in the diameter of the graph. $\begin{array} { r } { O ( \frac { M ^ { 2 } } { m } \alpha ^ { - m } ) } \end{array}$ vs $\Omega ( M \alpha ^ { - M / 2 } )$
3) to obtain Proof. we sample it using a step size $\bar { d } _ { l } : = \mathrm { d i s t } _ { G } ( \breve { d } _ { L - m l } , s _ { * } )$ , l = 0, 1, . . . , Lm , which satisfies (such that mod $\bar { d } _ { l } \leq l m \bar { }$ , where $j$ for all is defined in Section $l$ .
For fixed $l$ , we initialize the chain $\overline { { K } }$ at $\bar { d } _ { l }$ : $\bar { z } _ { 0 } = \bar { d } _ { l }$ . Since $\begin{array} { r } { P r ( \bar { z } _ { m } = 0 ) \geq \prod _ { j = 0 } ^ { m - 1 } \alpha _ { j } : = \gamma _ { 0 , m } } \end{array}$ , after $O ( \gamma _ { 0 , m } ^ { - 1 } )$ trials of length $\leq M$ , we will reach the absorbing state and finally have a signal-carrying update for the Q-function at the originating state.
We can consequently merge that state into the absorbing state and reduce the length of the chain by one. Repeat the argument $m$ times so that after $O ( \sum _ { j = 0 } ^ { m } \gamma _ { j , m } ^ { - 1 } ) = O ( m \gamma _ { 0 , m } ^ { - 1 } )$ trials, the Q-function is updated at $\bar { z } _ { 0 }$ . Repeat at Backplay steps $\begin{array} { r } { m , l = 1 , \dots \frac { M } { m } } \end{array}$ m , and we reach a sample complexity of
$$T _ { m } = \sum _ { k = 0 } ^ { \frac { M } { m } - 1 } { \cal O } \left( M \sum _ { j = 0 } ^ { m } \gamma _ { k m , ( k + 1 ) m - j } ^ { - 1 } \right) \ .$$
In the case where $\alpha _ { l } = \alpha$ for all $l$ , we obtain $\gamma _ { k m , ( k + 1 ) m - j } ^ { - 1 } = \gamma _ { 0 , m - j } = \alpha ^ { - m + j }$ and therefore $\begin{array} { r } { T _ { m } = O \left( \frac { M ^ { 2 } ( 1 - \alpha ^ { m + 1 } ) } { m ( 1 - \alpha ) } \alpha ^ { - m } \right) } \end{array}$ , where the important term is the rate $\textstyle { \frac { M ^ { 2 } } { m } } \alpha ^ { - m }$ .
On the other hand, Hong & Zhou (2017) shows that the first-passage time $\tau ( 0 , M )$ in a skip-free finite Markov chain of $M$ states with a single absorbing state is a random variable whose momentgenerating function $\varphi ( s ) = \mathbb { E } s ^ { \tau ( s , s _ { * } ) }$ is given by
$$\varphi ( s ) = \prod _ { j = 1 } ^ { M } \frac { ( 1 - \lambda _ { j } ) s } { 1 - \lambda _ { j } s } ,$$
where $\lambda _ { 1 } , \dots , \lambda _ { M }$ are the non-unit eigenvalues of the transition probability matrix. It follows that $\begin{array} { r } { \mathbb { E } \tau ( 0 , M ) = \varphi ^ { \prime } ( 1 ) = \sum _ { j = 1 } ^ { M } \frac { 1 } { 1 - \lambda _ { j } } \approx ( 1 - \lambda _ { 1 } ) ^ { - 1 } } \end{array}$ , which corresponds to the reciprocal spectral gap.1 Chen & Saloff-Coste (2013) further shows that this reciprocal spectral gap is $\Omega ( \alpha ^ { - M / 2 } )$ in our case, and therefore the model without Backplay will on average take $T _ { M } = \Omega ( \alpha ^ { - M / 2 } )$ trials to reach the absorbing state and receive information. □
We can analyze the uniform strategy similarly. The probability that a trajectory initialized at one of the uniform samples will reach the absorbing state is lower bounded by
$$\sum _ { j = 1 } ^ { M } \alpha ^ { j } P ( \bar { z } _ { 0 } = j ) = \frac { 1 } { M } \sum _ { j = 1 } ^ { M } \alpha ^ { j } = \frac { \alpha - \alpha ^ { M + 1 } } { M ( 1 - \alpha ) } ,$$
which is approximately $\frac { \alpha } { M }$ when $\alpha$ is small, leading to a sample complexity of $O ( M ^ { 2 } \alpha ^ { - 1 } )$ to update the value function at the originating state, and $O ( M ^ { 3 } \alpha ^ { - 1 } )$ at the starting state. Comparing this rate to Backplay with $m = 1$ , observe that the uniform strategy is slower by a factor of $M$ (and one can verify that the same is true for generic step size $m$ by imagining that we first sampled a window of size $m$ and then sub-sampled our state from that window), suggesting that it loses efficiency on environments with large diameter.
The preceding analysis suggests that a full characterization of Backplay is a fruitful direction for reinforcement and imitation learning theory, albeit beyond the scope of this paper.
# 3.2 QUALITATIVE ANALYSIS
We now provide intuition regarding the conditions under which Backplay can improve sampleefficiency or lead to a better policy than that of the demonstrator. In addition, we discuss the differences between Backplay and other methods of reducing sample complexity for deep RL as well as when practitioners would choose to use one or the other.
Figure 2 contains three grid worlds. In each, the agent begins at $s _ { 0 }$ , receives $+ 1$ when it reaches $s _ { * }$ , and otherwise incurs a per step cost. They each pose a challenge to model free RL and highlight advantages and disadvantages of Backplay compared to other approaches like behavioral cloning (BC, Bain & Sommut (1999)), generative adversarial imitation learning (GAIL, Ho & Ermon (2016)), and reverse curriculum generation (RCG, Florensa et al. (2017)). See Table 1 for a direct comparison of these algorithms.
 Figure 2. Three environments illustrating when Backplay can help or hinder learning an optimal policy. Backplay is expected to learn faster than standard RL on the first and second mazes, but perform worse on the third maze.
The left grid world shows a sparse reward environment in which Backplay can decrease the requisite training time compared to standard RL. Using the sub-optimal demonstration will position the Backplay agent close to high value states. In addition, the agent will likely surpass the expert policy because, unlike in BC approaches, Backplay does not encourage the agent to imitate expert actions. Rather, the curriculum forces the agent to first explore states with large associated value and, consequently, estimating the value function suffers less from the curse of dimensionality. And finally, we expect it to also surpass results from RCG because random movements from the goal state will progress very haphazardly in such an open world.
The middle grid illustrates a maze with bottlenecks. Backplay will vastly decrease the exploration time relative to standard RL, because the agent will be less prone to exploring the errant right side chamber where it can get lost if it traverses to the right instead of going up to the goal. If we used BC, then the agent will sufficiently learn the optimal policy, however it will suffer when placed in nearby spots on the grid as they will be out of distribution; Backplay-trained agents will not have this problem as they also explore nearby states. When an RCG agent reaches the first fork, it has an even chance of exploring the right side of the grid and wasting lots of sample time.
On the rightmost grid world, while Backplay is still likely to surpass its demonstrator, it will have trouble doing better than standard RL because the latter always starts at $s _ { 0 }$ and consequently is more likely to stumble upon the optimal solution of going up and right. In contrast, Backplay will spend the dominant amount of its early training starting in states in the sub-optimal demonstration. Note that BC will be worse off than Backplay because by learning the demonstration, it will follow the trajectory into the basin instead of going up the right side. Finally, observe that RCG will likely outperform here given that it has a high chance of discovering the left side shortcut and, if not, it would more likely discover the right side shortcut than be trapped in the basin.
In summary, Backplay is not a universal strategy to improve sample complexity. Even in the navigation setting, if the task randomizes the initial state $s _ { 0 }$ , a single demonstration trajectory does not generally improve the coverage of the state-space outside an exponentially small region around said trajectory. For example, imagine a binary tree and a navigation task that starts at a random leaf and needs to reach the root. A single expert trajectory will be disjoint from half of the state space (because the root is absorbing), thus providing no sample complexity gains on average.
Table 1: Comparison of Backplay with related work: Behavioral Cloning (BC), Generative Adversarial Imitation Learning (GAIL), and Reverse Curriculum Generation (RCG).
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Requirements</td><td rowspan=1 colspan=1>Main Idea</td><td rowspan=1 colspan=1>MainWeakness</td></tr><tr><td rowspan=1 colspan=1>BC</td><td rowspan=1 colspan=1>(State,Action) pairs fromexpert trajectory.</td><td rowspan=1 colspan=1>Learn policy that imitates theexpert demonstration.</td><td rowspan=1 colspan=1>Sub-optimal expert can yield avery poor learned policy.</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>(State,Action) pairs fromexpert trajectory.</td><td rowspan=1 colspan=1>Learn a policythat matchesthe distribution of expert tra-jectory pairs.</td><td rowspan=1 colspan=1>Difficult to tune; Requires moreworld interactions; Can performworse than BC.</td></tr><tr><td rowspan=1 colspan=1>RCG</td><td rowspan=1 colspan=1>Reversable transition func-tion of environment; Reset-table environment.</td><td rowspan=1 colspan=1>Take randomwalks from goalstate to build curriculum of ini-tial starting states.</td><td rowspan=1 colspan=1>Complexitymay increase if ran-dom walks reach parts of statespace irrelevant to a good policy.</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>State sequence froma‘good enough’ trajectory;Resettable environment.</td><td rowspan=1 colspan=1>Sample starting state fromgiven trajectory by walkingbackward along trajectory.</td><td rowspan=1 colspan=1>If states in‘good enough'tra- jectory are not optimal, then canslow learning the optimal policy.</td></tr></table>
# 4 EXPERIMENTS
We now move to evaluating Backplay empirically in two environments: a grid world maze and a four-player free-for-all game. The questions we study across both environments are the following:
• Is Backplay more efficient than training an RL agent from scratch? • How does the quality of the given demonstration affect the effectiveness of Backplay? • Can Backplay agents surpass the demonstrator when it is non-optimal? • Can Backplay agents generalize?
# 4.1 TRAINING DETAILS
We compare several training regimes. The first is Backplay, which uses the Backplay algorithm corresponding to a particular sequence of windows and epochs as specified in A.1. The second, Standard is vanilla model-free RL with the agent always starting at the initial state $s _ { 0 }$ . The last, Uniform, is an ablation that considers how important is the curriculum aspect of Backplay by sampling initial states randomly from the entire demonstration. In all these regimes, we use Proximal Policy Optimization (PPO, Schulman et al. (2017)) to train an agent with policy and value functions parameterized by convolutional neural networks.
On the Maze environment (detailed below), we also ran comparisons against Behavioral Cloning and Reverse Curriculum Generation. We chose BC over GAIL (Ho & Ermon, 2016) for three reasons. First, GAIL requires careful hyperparameter tuning and is thus difficult to train. Second, GAIL requires more environment interactions. And third, GAIL has recently been shown to perform significantly worse than BC (Behbahani et al., 2018).
Training details and network architectures for all the environments can be found in A.3 and A.6, while A.9 contains empirical observations for using Backplay in practice.
# 4.2 MAZE
We generated mazes of size $2 4 \times 2 4$ with 120 randomly placed walls, a random start position, and a random goal position. We then used $\mathbf { A } ^ { * }$ to generate trajectories. These included both Optimal demonstrations (true shortest path) and N-Optimal demonstrations (N steps longer than the shortest path). More details on this setup are given in A.2.
<table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Map Set</td><td rowspan=1 colspan=1>% Optimal</td><td rowspan=1 colspan=1>% 0-5 Optimal</td><td rowspan=1 colspan=1>Avg Suboptimality</td><td rowspan=1 colspan=1> Std Suboptimality</td></tr><tr><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=1>All</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>27</td><td rowspan=1 colspan=1>91</td><td rowspan=1 colspan=1>8.26</td><td rowspan=1 colspan=1>32.92</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>51</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>2.04</td><td rowspan=1 colspan=1>17.39</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>2.04</td><td rowspan=1 colspan=1>16.79</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>51</td><td rowspan=1 colspan=1>63.36</td><td rowspan=1 colspan=1>78.08</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>77</td><td rowspan=1 colspan=1>25.44</td><td rowspan=1 colspan=1>56.89</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>39.75</td><td rowspan=1 colspan=1>70.92</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>31</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>4.96</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>94</td><td rowspan=1 colspan=1>7.94</td><td rowspan=1 colspan=1>33.35</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>0.37</td><td rowspan=1 colspan=1>3.49</td></tr></table>
Table 2: Results after 2000 epochs on 100 mazes. Note that for Backplay and Uniform, the Map Set is also the type of demonstrator, where N-optimal has demonstrations $\mathbf { N }$ steps longer than the shortest path. From left to right, the table shows: the percentage of mazes on which the agent optimally reaches the goal, percentage on which it reaches in at most five steps more than optimal, and the average and standard deviation of extra steps over optimal. Both Backplay and Uniform succeed on almost all mazes and, importantly, can outperform the experts’ demonstrations. On the other hand, Standard does not learn a useful policy and Florensa fails to learn more than $5 0 - 7 0 \%$ of the maps, which is why its sub-optimality mean and std is so high. Results for Backplay were generally consistent across all seeds. For others, we report their best score. See A.4 for further details.
Our model receives as input four $2 4 \times 2 4$ binary maps. They contain ones at the positions of, respectively, the agent, the goal, passages, and walls. It outputs one of five options: Pass, Up, Down, Left, or Right. The game ends when the agent has reached its goal or after a maximum of 200 steps, whereupon the agent receives reward of $+ 1$ if it reaches the goal and a per step penalty of -0.03.
Backplay, Uniform, Standard. Table 2 shows that Standard has immense trouble learning in this sparse reward environment while both Backplay and Uniform find an optimal path approximately 30- $50 \%$ of the time and a path within five of the optimal path almost always. Thus, in this environment, demonstrations of even sub-optimal experts are extremely useful, while the curriculum created by Backplay is not necessary. That curriculum does, however, aid convergence speed (A.4). We will see in 4.3 that the curriculum becomes vital as the environment increases in complexity.
Behavioral Cloning. We trained an agent using behavioral cloning from the same trajectories as the ones used for Backplay. While the agent learns to perfectly imitate those trajectories, we had immense difficult doing better than the expert. All of our attempts to use reward signal to improve the agent’s performance (over that of the behaviorally cloned agent) were unsuccessful, even after incorporating tricks in the literature such as those found in Schmitt et al. (2018). One possible reason is that the agent has no information about states outside of the demonstration trajectory.
Reverse Curriculum Generation. We also compared Backplay to the method proposed by Florensa et al. (2017). As illustrated in Table 2 and Section A.4, Florensa agents perform significantly worse with higher sample complexity variance compared to Backplay (or Uniform). This suggests that having demonstrations helps inordinately. Further details can be found in A.3.
# 4.3 POMMERMAN
Pommerman is a stochastic environment (Resnick et al., 2018) based on the classic console game Bomberman and will be a competition at NeurIPS 2018. It is played on an 11x11 grid where on every turn, each of four agents either move in a cardinal direction, pass, or lay a bomb. The agents begin fenced in their own area by two different types of walls - rigid and wooden. The former are indestructible while bombs destroy the latter. Upon blowing up wooden walls, there is a uniform chance at yielding one of three power-ups: an extra bomb, an extra unit of range in the agent’s bombs, or the ability to kick bombs. The maps are designed randomly, albeit there is always a guaranteed path between any two agents. For a visual aid of the start state, see Figure 8 in A.5.
In our experiments, we use the purely adversarial Free-For-All (FFA) environment. This environment is introduced in (MultiAgentLearning, 2018; Resnick et al., 2018) and we point the reader there for more details. The winner of the game is the last agent standing. It is played from the perspective of one agent whose starting position is uniformly picked among the four. The three opponents are copies of the winner of the June 3rd 2018 FFA competition, a stochastic agent using a Finite State Machine Tree-Search approach (FSMTS, Zhou et al. (2018)). We also make use of the FSMTS agent as the ‘expert’ in the Backplay demonstrations.
The observation state is represented by 19 11x11 maps, and we feed the concatenated last two states to our agent as input. A detailed description of this mapping is given in A.5. The game ends either when the learning agent wins or dies, or when 800 steps have passed. Upon game end, the agent receives $+ 1$ for winning and $- 1$ otherwise (Sparse). We also run experiments where the agent additionally receives $+ 0 . 1$ whenever it collects an item (Dense).
 Figure 3. Pommerman results (5 seeds) when training with sparse rewards. Plots a and $\mathbf { b }$ are trained from the perspective of the winning agent, while c is trained from that of the runner up. The red bar indicates when the Backplay models begin training only on the initial state. Plot a is our starkest result and displays results on games starting from the initial state only regardless of when training occurs. you can see here that Backplay attains strong results where Uniform and Standard fail to learn anything of note.
 Figure 4. Pommerman results (5 seeds) when training with dense rewards. Again, a and $\mathbf { b }$ are trained from the perspective of the winning agent, while c is trained from that of the runner up. The cause of the higher variance in a was one of the seeds was worse than the others. Nonetheless, they all still did much better than either Standard or Uniform.
Our first three scenarios follow the Sparse setup. We independently consider three Backplay trajectories, one following the winner over 100 maps, one following the winner over four maps, and one following the runner up over four maps, with the latter two set of maps being the same. Figure 3 shows that Backplay can soundly defeat the FSMTS agents in sparse settings when following the winner, even when there are 100 maps to consider, while other methods struggle in this setup. Modulo higher variance in Backplay’s result, we see a similar comparison in the runner-up case. Visit this link for an example gif of our trained Backplay agent (top left - red). Note that our agent learned to ‘throw’ bombs, a unique playing style that no prior Pommerman competitor had exhibited, including the FSMTS demonstrator.
Moreover, by training on 100 maps, Backplay generalizes (to some extent) on unseen boards. Backplay wins 416 / 1000 games on a held out set of ten maps, with the following success rates on each: $8 5 . 3 \%$ , $8 4 . 1 \%$ , $8 1 . 6 \%$ , $7 9 . 5 \%$ , $5 2 . 4 \%$ , $4 7 . 4 \%$ , $3 8 . 1 \%$ , $2 2 . 6 \%$ , $20 \%$ , and $1 8 . 3 \%$ . This was in contrast to our Maze experiments where no approach generalized. Given this discrepancy, we believe that the lack of generalization was a consequence of not including enough mazes during training.
# 5 CONCLUSION
We have introduced and analyzed Backplay, a technique which improves the sample efficiency of model-free RL by constructing a curriculum around a demonstration. We showed that Backplay agents can learn in complex environments where standard model-free RL fails, that they can outperform the ‘expert’ whose trajectories they use while training, and that they compare very favorably to related methods such as reversible curriculum generation. We also presented a theoretical analysis of its sample complexity gains in a simplified setting.
An important future direction is combining Backplay with more complex and complementary methods such as Monte Carlo Tree Search (MCTS, (Browne et al., 2012; Vodopivec et al., 2017)). There are many potential ways to do so, for example by using Backplay to warm-start MCTS.
Another direction is to use Backplay to accelerate self-play learning in zero-sum games. However, special care needs to be taken to avoid policy correlation during training (Lanctot et al., 2017) and thus to make sure that learned strategies are safe and not exploitable (Brown & Sandholm, 2017).
A third direction is towards non-zero sum games. It is well known that standard independent multiagent learning does not produce agents that are able to cooperate in social dilemmas (Leibo et al., 2017; Lerer & Peysakhovich, 2017; Peysakhovich & Lerer, 2017; Foerster et al., 2017) or risky coordination games (Yoshida et al., 2008; Peysakhovich & Lerer, 2018). In contrast, humans are much better at finding these coordinating and cooperating equilibria (Bó, 2005; Kleiman-Weiner et al., 2016). Thus, we conjecture that human demonstrations can be combined with Backplay to construct agents that perform well in such situations.
Other future priorities are to gain further understanding into when Backplay works well, when it fails, and how we can make the procedure more efficient. Could we speed up Backplay by ascertaining confidence estimates of state values? Do the gains in sample complexity come from value estimation like our analysis suggests, from policy iteration, or from both? Is there an ideal rate for advancing the curriculum window and is there a better approach than a hand-tuned schedule?
# REFERENCES
Yusuf Aytar, Tobias Pfaff, David Budden, Tom Le Paine, Ziyu Wang, and Nando de Freitas. Playing hard exploration games by watching youtube. arXiv preprint arXiv:1805.11592, 2018. Michael Bain and Claude Sommut. A framework for behavioural claning. Machine intelligence, 15 (15):103, 1999. Feryal Behbahani, Kyriacos Shiarlis, Xi Chen, Vitaly Kurin, Sudhanshu Kasewa, Ciprian Stirbu, João Gomes, Supratik Paul, Frans A Oliehoek, João Messias, et al. Learning from demonstration in the wild. arXiv preprint arXiv:1811.03516, 2018. Pedro Dal Bó. Cooperation under the shadow of the future: experimental evidence from infinitely repeated games. American economic review, 95(5):1591–1604, 2005. Noam Brown and Tuomas Sandholm. Safe and nested subgame solving for imperfect-information games. In Advances in Neural Information Processing Systems, pp. 689–699, 2017. Cameron B Browne, Edward Powley, Daniel Whitehouse, Simon M Lucas, Peter I Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of monte carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in games, 4(1):1–43, 2012. Guan-Yu Chen and Laurent Saloff-Coste. On the mixing time and spectral gap for birth and death chains. arXiv preprint arXiv:1304.4346, 2013. J. Clark and D. Amodei. Faulty reward functions in the wild. https://blog.openai.com/ faulty-reward-functions/, 2016. Abhishek Das, Samyak Datta, Georgia Gkioxari, Stefan Lee, Devi Parikh, and Dhruv Batra. Embodied question answering. CoRR, abs/1711.11543, 2017a.
Abhishek Das, Satwik Kottur, José M. F. Moura, Stefan Lee, and Dhruv Batra. Learning cooperative visual dialog agents with deep reinforcement learning. CoRR, abs/1703.06585, 2017b.
Hal Daumé, John Langford, and Daniel Marcu. Search-based structured prediction. Machine learning, 75(3):297–325, 2009.
Ashley D Edwards, Laura Downs, and James C Davidson. Forward-backward reinforcement learning. arXiv preprint arXiv:1803.10227, 2018.
Carlos Florensa, David Held, Markus Wulfmeier, and Pieter Abbeel. Reverse curriculum generation for reinforcement learning. arXiv preprint arXiv:1707.05300, 2017.
Jakob N Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. arXiv preprint arXiv:1709.04326, 2017.
Yang Gao, Ji Lin, Fisher Yu, Sergey Levine, Trevor Darrell, et al. Reinforcement learning from imperfect demonstrations. arXiv preprint arXiv:1802.05313, 2018.
Anirudh Goyal, Philemon Brakel, William Fedus, Timothy Lillicrap, Sergey Levine, Hugo Larochelle, and Yoshua Bengio. Recall traces: Backtracking models for efficient reinforcement learning. arXiv preprint arXiv:1804.00379, 2018.
Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Gabriel Dulac-Arnold, et al. Deep q-learning from demonstrations. arXiv preprint arXiv:1704.03732, 2017.
Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
Wenming Hong and Ke Zhou. A note on the passage time of finite-state markov chains. Communications in Statistics-Theory and Methods, 46(1):438–445, 2017.
Ionel-Alexandru Hosu and Traian Rebedea. Playing atari games with deep reinforcement learning and human checkpoint replay. arXiv preprint arXiv:1607.05077, 2016.
Boris Ivanovic, James Harrison, Apoorva Sharma, Mo Chen, and Marco Pavone. Barc: Backward reachability curriculum for robotic reinforcement learning. arXiv preprint arXiv:1806.06161, 2018.
Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In Claude Sammut and Achim G. Hoffmann (eds.), ICML, pp. 267–274. Morgan Kaufmann, 2002. ISBN 1-55860-873-7. URL http://dblp.uni-trier.de/db/conf/icml/ icml2002.html#KakadeL02.
Max Kleiman-Weiner, Mark K Ho, Joseph L Austerweil, Michael L Littman, and Joshua B Tenenbaum. Coordinate to cooperate or compete: abstract goals and joint intentions in social interaction. In COGSCI, 2016.
Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Julien Perolat, David Silver, Thore Graepel, et al. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4190–4203, 2017.
Michael Laskey, Sam Staszak, Wesley Yu-Shu Hsieh, Jeffrey Mahler, Florian T Pokorny, Anca D Dragan, and Ken Goldberg. Shiv: Reducing supervisor burden in dagger using support vectors for efficient learning from demonstrations in high dimensional state spaces. In Robotics and Automation (ICRA), 2016 IEEE International Conference on, pp. 462–469. IEEE, 2016.
Joel Z Leibo, Vinicius Zambaldi, Marc Lanctot, Janusz Marecki, and Thore Graepel. Multi-agent reinforcement learning in sequential social dilemmas. In Proceedings of the 16th Conference on Autonomous Agents and MultiAgent Systems, pp. 464–473. International Foundation for Autonomous Agents and Multiagent Systems, 2017.
Adam Lerer and Alexander Peysakhovich. Maintaining cooperation in complex social dilemmas using deep reinforcement learning. arXiv preprint arXiv:1707.01068, 2017.
Adam Lerer and Alexander Peysakhovich. Learning social conventions in markov games. arXiv preprint arXiv:1806.10071, 2018.
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016. URL http: //jmlr.org/papers/v17/15-522.html.
Jiwei Li, Will Monroe, Alan Ritter, Michel Galley, Jianfeng Gao, and Dan Jurafsky. Deep reinforcement learning for dialogue generation. CoRR, abs/1606.01541, 2016.
Stephen McAleer, Forest Agostinelli, Alexander Shmakov, and Pierre Baldi. Solving the rubik’s cube without human knowledge. arXiv preprint arXiv:1805.07470, 2018.
Matej Moravcík, Martin Schmid, Neil Burch, Viliam Lisý, Dustin Morrill, Nolan Bard, Trevor Davis, Kevin Waugh, Michael Johanson, and Michael H. Bowling. Deepstack: Expert-level artificial intelligence in no-limit poker. CoRR, abs/1701.01724, 2017. URL http://arxiv.org/abs/ 1701.01724.
MultiAgentLearning. Pommerman. https://github.com/MultiAgentLearning/ playground, 2018.
Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. arXiv preprint arXiv:1709.10089, 2017.
Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
Xue Bin Peng, Pieter Abbeel, Sergey Levine, and Michiel van de Panne. Deepmimic: Example-guided deep reinforcement learning of physics-based character skills. arXiv preprint arXiv:1804.02717, 2018.
Alexander Peysakhovich and Adam Lerer. Consequentialist conditional cooperation in social dilemmas with imperfect information. arXiv preprint arXiv:1710.06975, 2017.
Alexander Peysakhovich and Adam Lerer. Prosocial learning agents solve generalized stag hunts better than selfish ones. Proceedings of the 17th Conference on Autonomous Agents and MultiAgent Systems, 2018.
Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. CoRR, abs/1511.06732, 2015.
Cinjon Resnick, Wes Eldridge, David Ha, Denny Britz, Jakob Foerster, Julian Togelius, Kyunghyun Cho, and Joan Bruna. Pommerman: A multi-agent playground, 2018.
Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 627–635, 2011.
Tim Salimans and Richard Chen. Learning montezuma’s revenge from a single demonstration. https://blog.openai.com/ learning-montezumas-revenge-from-a-single-demonstration/, 2018. Accessed: 2018-07-12.
Simon Schmitt, Jonathan J Hudson, Augustin Zidek, Simon Osindero, Carl Doersch, Wojciech M Czarnecki, Joel Z Leibo, Heinrich Kuttler, Andrew Zisserman, Karen Simonyan, et al. Kickstarting deep reinforcement learning. arXiv preprint arXiv:1803.03835, 2018.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy P. Lillicrap, Karen Simonyan, and Demis Hassabis. Mastering chess and shogi by self-play with a general reinforcement learning algorithm. CoRR, abs/1712.01815, 2017. URL http://arxiv.org/ abs/1712.01815.
Tom Vodopivec, Spyridon Samothrakis, and Branko Šter. On monte carlo tree search and reinforcement learning. J. Artif. Int. Res., 60(1):881–936, September 2017. ISSN 1076-9757. URL http://dl.acm.org/citation.cfm?id $\equiv$ 3207692.3207712.
Wako Yoshida, Ray J Dolan, and Karl J Friston. Game theory of mind. PLoS computational biology, 4(12):e1000254, 2008.
Jiakai Zhang and Kyunghyun Cho. Query-efficient imitation learning for end-to-end autonomous driving. arXiv preprint arXiv:1605.06450, 2016.
Hongwei Zhou, Yichen Gong, Luvneesh Mugrai, Ahmed Khalifa, Andy Nealen, and Julian Togelius. A hybrid search agent in pommerman. In Proceedings of the 13th International Conference on the Foundations of Digital Games, FDG ’18, pp. 46:1–46:4, New York, NY, USA, 2018. ACM. ISBN 978-1-4503-6571-0. doi: 10.1145/3235765.3235812. URL http://doi.acm.org/10. 1145/3235765.3235812.
Yuke Zhu, Ziyu Wang, Josh Merel, Andrei A. Rusu, Tom Erez, Serkan Cabi, Saran Tunyasuvunakool, János Kramár, Raia Hadsell, Nando de Freitas, and Nicolas Heess. Reinforcement and imitation learning for diverse visuomotor skills. CoRR, abs/1802.09564, 2018.
# A APPENDIX
# A.1 BACKPLAY HYPERPARAMETERS
As mentioned in Section 3, the Backplay hyperparameters are the window bounds and the frequency with which they are shifted. When we get to a training epoch represented in the sequence of epochs, we advance to the corresponding value in the sequence of windows. For example, consider training an agent with Backplay in the Maze environment (Table 3) and assume we are at epoch 1000. We will select a maze at random, an $N \in [ 1 6 , 3 2 )$ , and start the agent in that game $N$ steps from the end. Whenever a pair is chosen such that the game’s length is smaller than $N$ , we use the initial state.
There isn’t any downside to having the model continue training in a window for too long, albeit the ideal is that this method increases the speed of training. There is however a downside to advancing the window too quickly. A scenario common to effective training is improving success curves punctured by step drops whenever the window advances.
Table 3: Backplay hyperparameters for Maze.
<table><tr><td>Starting at training epoch</td><td>Uniform window</td></tr><tr><td>0</td><td>[0,4)</td></tr><tr><td>350</td><td>[4,8)</td></tr><tr><td>700</td><td>[8,16)</td></tr><tr><td>1050</td><td>[16,32)</td></tr><tr><td>1400</td><td>[32, 64)</td></tr><tr><td>1750</td><td>[64,64)</td></tr></table>
Table 4: Backplay hyperparameters for Pommerman 4 maps.
<table><tr><td>Starting at training epoch</td><td>Uniform window</td></tr><tr><td>0</td><td>[0,32)</td></tr><tr><td>50</td><td>[24,64)</td></tr><tr><td>100</td><td>[56,128)</td></tr><tr><td>150</td><td>[120,256)</td></tr><tr><td>200</td><td>[248, 512)</td></tr><tr><td>250</td><td>[504,800)</td></tr><tr><td>300</td><td>[800,800]</td></tr></table>
Table 5: Backplay hyperparameters for Pommerman 100 maps.
<table><tr><td>Starting at training epoch</td><td>Uniformwindow</td></tr><tr><td>0</td><td>[0,32)</td></tr><tr><td>85</td><td>[24,64)</td></tr><tr><td>170</td><td>[56,128)</td></tr><tr><td>255</td><td>[120,256)</td></tr><tr><td>340</td><td>[248,512)</td></tr><tr><td>425</td><td>[504, 800)</td></tr><tr><td>510</td><td>[800,800]</td></tr></table>
# A.2 MAZE: DEMONSTRATION DETAILS
For N-Optimal demonstrations, we used a noisy $\mathbf { A } ^ { * }$ where at each step, we follow $\mathbf { A } ^ { * }$ with probability $p$ or choose a random action otherwise. We considered $N \in \{ 5 , 1 0 \}$ . In all scenarios, we only selected maps in which there exists at least a path from the the initial state to the goal state, we filtered any path that was less than 35 in length and stopped when we found a hundred valid training games. Note that we held the demonstration length invariant rather than the optimal length (i.e. all N-optimal paths have the same length regardless of N, which means that the length of the optimal path of a N-optimal demonstration decreases with N). This could explain why the results in Table 2 (column 1) show that Backplay’s performance increases with $_ \mathrm { N }$ (since the larger the N, the smaller the true optimal path, so the easier it is to learn an optimal policy for that maze configuration).
A.3 MAZE: NETWORK ARCHITECTURE AND TRAINING PARAMETERS
We use a standard deep RL setup for our agents. The agent’s policy and value functions are parameterized by a convolutional neural network with 2 layers each of 32 output channels, followed by two linear layers with 128 dimensions. Each of the layers are followed by ReLU activations. This body then feeds two heads, a scalar value function and a softmax policy function over the five actions. All of the CNN kernels are 3x3 with stride and padding of one.
We train our agent using Proximal Policy Optimization (PPO, Schulman et al. (2017)) with $\gamma = 0 . 9 9$ , learning rate $\mathrm { \check { 1 } } \times 1 0 ^ { - 3 }$ , batch size 102400, 60 parallel workers, clipping parameter 0.2, generalized advantage estimation with $\tau = 0 . 9 5$ , entropy coefficient 0.01, value loss coefficient 0.5, mini-batch size 5120, horizon 1707, and 4 PPO updates at each iteration. The number of interactions per epoch is equal to the batch size (102400).
The hyperparameters used for training the agent with Reverse Curriculum Generation (Florensa et al., 2017) are: $1 0 ^ { 4 }$ rollout states for nearby sampling, 50 Brownian steps, 200 samples from new starts, 100 samples from old starts, interval for the expected return [0.1, 0.9].
# A.4 MAZE: LEARNING CURVES
Below are our learning curves for the Maze challenge over five seeds. Note that we do not show any results for Standard as it failed to learn much of anything in the time allotted (3500 epochs). Also note that Backplay occasionally sees the actual grid starting position from epoch 1400, but it becomes the default starting state at epoch 1750. To align with this, our Florensa baseline switches to training from the actual start position at epoch 1750, and we show results for Uniform only over the initial starting state. Correspondingly, we show the graphs from epoch 1000 as all of the methods have commensurately poor results before that time.
 Figure 5. Maze results when training with demonstrations of length equal to the optimal path length. Note that Backplay has a very small variance and a very high success rate as early as epoch 1800. On the other hand, Florensa fails to break $70 \%$ and has a high variance, and Uniform doesn’t achieve a strong success rate until epoch 3000.
 Figure 6. Maze results when training with demonstrations that are five steps longer than the optimal path length. Compared to the prior graph, Backplay doesn’t do as well, albeit it still performs favorably compared to Florensa, with a consistently higher expected return. Its advantage over Uniform is a reduced amount of necessary samples.
 Figure 7. Maze results when training with demonstrations that are ten steps longer than the optimal path length. We again see that Backplay does very well compared to the Florensa baseline, with a much stronger expected return and lower variance. We also see, however, that Uniform is an able competitor to both of these as the expert becomes more suboptimal.
# A.5 POMMERMAN: OBSERVATION STATE
 Figure 8. Pommerman start state. Each agent begins in one of four positions. Yellow squares are wood, brown are rigid, and gray are passages.
There are 19 feature maps that encompass each observation. They consist of the following: the agents’ identities and locations, the locations of the walls, power-ups, and bombs, the bombs’ blast strengths and remaining life counts, and the current time step.
The first map contains the integer values of each bomb’s blast strength at the location of that bomb. The second map is similar but the integer value is the bomb’s remaining life. At all other positions, the first two maps are zero. The next map is binary and contains a single one at the agent’s location. If the agent is dead, this map is zero everywhere. The following two maps are similar. One is full with the agent’s integer current bomb count, the other with its blast radius. We then have a full binary map that is one if the agent can kick and zero otherwise.
The next maps deal with the other agents. The first contains only ones if the agent has a teammate and zeros otherwise. This is useful for building agents that can play both team and solo matches. If the agent has a teammate, the next map is binary with a one at the teammate’s location (and zero if she is not alive). Otherwise, the agent has three enemies, so the next map contains the position of the enemy that started in the diagonally opposed corner from the agent. The following two maps contain the positions of the other two enemies, which are present in both solo and team games.
We then include eight feature maps representing the respective locations of passages, rigid walls, wooden walls, flames, extra-bomb power-ups, increase-blast-strength power-ups, and kicking-ability power-ups. All are binary with ones at the corresponding locations.
Finally, we include a full map with the float ratio of the current step to the total number of steps. This information is useful for distinguishing among observation states that are seemingly very similar, but in reality are very different because the game has a fixed ending step where the agent receives negative reward for not winning.
# A.6 POMMERMAN: NETWORK ARCHITECTURE AND TRAINING PARAMETERS
We use a similar setup to that used in the Maze game. The architecture differences are that we have an additional two convolutional layers at the beginning, use 256 output channels, and have output dimensions of 1024 and 512, respectively, for the linear layers. This architecture was not tuned at all duringrate of $3 \times 1 0 ^ { - 4 }$ of our experiments. Further hyperparameter differences are that wand a gamma of 1.0. These models trained for 72 hours, which is ${ \sim } 5 0 \mathrm { M }$ a learning frames. 2
 Figure 9. Typical histograms for how the Pommerman action selections change over time. From left to right are the concatenated counts of the actions (Pass, Up, Down, Left, Right, Bomb), delineated on the y-axis by the epoch. Note how the Standard agent learns to not use bombs.
Pommerman can be difficult for reinforcement learning agents. The agent must learn to effectively wield the bomb action in order to win against competent opponents. However, bombs destroy agents indiscriminately, so placing one without knowing how to retreat often results in negative reward for that agent. Since agents begin in an isolated area, they are prone to converging to policies which do not use the bomb action (as seen in the histograms in Figure 9), which leads them to sub-optimal policies in the long-term.
# A.8 POMMERMAN: WIN RATES
Here we show the per-map win rates obtained by the agent trained with Backlpay on the 100 Pommerman maps.
<table><tr><td rowspan=1 colspan=1>Win</td><td rowspan=1 colspan=1>Maps</td></tr><tr><td rowspan=1 colspan=1>90%</td><td rowspan=1 colspan=1>24</td></tr><tr><td rowspan=1 colspan=1>80%</td><td rowspan=1 colspan=1>26</td></tr><tr><td rowspan=1 colspan=1>70%</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>60%</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>5</td></tr></table>
Table 6: Aggregate per-map win rates of the model trained with Backplay on 100 Pommerman maps. The model was run over 5000 times in total, with at least 32 times on each of the 100 maps. The Maps column shows the number of maps on which the Backplay agent had a success rate of at least the percent in the Win column. Note that this model has a win rate of $> 8 0 \%$ on more than half of the maps and a win rate of $> 5 0 \%$ on all maps.
# A.9 PRACTICAL FINDINGS
We trained a large number of models through our research into Backplay. Though these findings are tangential to our main points (and are mainly qualitative), we list some observations here that may be helpful for other researchers working with Backplay.
First, we found that Backplay does not perform well when the curriculum is advanced too quickly, however it does not fail when the curriculum is advanced ‘too slowly.’ Thus, researchers interested in using Backplay should err on the side of advancing the window too slowly rather than too quickly.
Second, we found that Backplay does not need to hit a high success rate before advancing the starting state window. Initially, we tried using adaptive approaches that advanced the window when the agent reached a certain success threshold. This worked but was too slow. Our hypothesis is that what is more important is that the agent gets sufficiently exposed to enough states to attain a reasonable barometer of their value rather than that the agent learns a perfectly optimal policy for a particular set of starting states.
Third, Backplay can still recover if success goes to zero. This surprising and infrequent result occurred at the juncture where the window moved back to the initial state and even if the policy’s entropy over actions became maximal. We are unsure what differentiates these models from the ones that did not recover.
We also explored using DAgger (Ross et al. (2011)) for training our agent, but found that it achieved approximately the same win rate $( \sim 2 0 \% )$ ) as what we would expect when four FSMTS agents played each other (given that there are also ties).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557# A SPECTRAL APPROACH TO GENERALIZATION ANDOPTIMIZATION IN NEURAL NETWORKS
Anonymous authors Paper under double-blind review
# ABSTRACT
The recent success of deep neural networks stems from their ability to generalize well on real data; however, Zhang et al. (Zhang et al., 2016) have observed that neural networks can easily overfit random labels. This observation demonstrates that with the existing theory, we cannot adequately explain why gradient methods can find generalizable solutions for neural networks. In this work, we use a Fourierbased approach to study the generalization properties of gradient-based methods over 2-layer neural networks with sinusoidal activation functions. We prove that if the underlying distribution of data has nice spectral properties such as bandlimitedness, then the gradient descent method will converge to generalizable local minima. We also establish a Fourier-based generalization bound for bandlimited spaces, which generalizes to other activation functions. Our generalization bound motivates a grouped version of path norms for measuring the complexity of 2-layer neural networks with ReLU activation functions. We demonstrate numerically that regularization of this group path norm results in neural network solutions that can fit true labels without losing test accuracy while not overfitting random labels.
# 1 INTRODUCTION
Deep neural networks (DNNs) have achieved state-of-the-art performance on a wide array of diverse tasks (LeCun et al., 2015). A given DNN architecture represents a highly rich space of hypotheses. However, numerous empirical results have demonstrated that a simple stochastic gradient descent (SGD) learner can efficiently search over this space to find a solution that achieves high performance on both training and test data. Despite many successful applications of DNNs to practical tasks such as computer vision (Krizhevsky et al., 2012), natural language processing (Collobert & Weston, 2008) and speech recognition (Hinton et al., 2012), our basic understanding of the factors that drive DNN generalization is still lacking.
Addressing generalization for DNNs is hard for two fundamental reasons: 1) Empirical risk minimization for neural networks is a non-convex optimization problem with possibly many local minima, and 2) Two different local minima with the same training performance can achieve significantly different performance on test data. For these reasons, the neural network optimization method plays an important role in the generalizability of the local minima found. For example, SGD has been empirically shown to outperform large-batch gradient descent (Keskar et al., 2016). Also, the performance of gradient methods can be improved upon by incorporating the geometry of observed data (Duchi et al., 2011; Neyshabur et al., 2015a).
For DNNs, however, a good optimization method is not sufficient for guaranteeing good generalization. Zhang et al. (Zhang et al., 2016) empirically demonstrate that a neural network trained by SGD can easily overfit random labels on the CIFAR-10 (Krizhevsky & Hinton, 2009) data. Yet, the same neural network fitted by the same SGD algorithm achieves good generalization performance for the original CIFAR-10 labels. This observation challenges the ability of traditional learning theory to explain why SGD learns generalizable hypotheses over neural networks. To shed light on this phenomenon, two recent works have developed generalization bounds and complexity measures for neural networks which can distinguish the local minima found for true and random labels. (Bartlett et al., 2017) proves a margin-based generalization bound and shows how it correlates with the generalization risk of DNNs when fitting true and random labels. (Neyshabur et al., 2017) explores different complexity scores for DNNs and how they behave differently for true and random labels. The complexity measures investigated in these works can effectively distinguish generalizable from poorly-generalizable local minima. They do not explain, however, why SGD converges to generalizable local minima when there exist poorly-generalizable local minima which can also perfectly fit the training set.
 Figure 1: (a) A 2-layer neural network with activation function $\phi$ , (b) Training and test accuracy on CIFAR10 with true and random labels on a 2-layer neural network with 512 ReLU hidden units, regularized with an additive penalty: (b1) no penalty, (b2) $\ell _ { 2 }$ -norm, (b3) $\chi _ { 2 }$ -group path norm, (b4) $\ell _ { 1 }$ -path norm. The $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm were successful to close the generalization gap for both true and random labels.
To approach this question, one needs to understand the key characteristic of CIFAR-10’s original labeling which differentiates it from random labels and how it is exploited by SGD to achieve good generalization performance. In this work, we approach this problem in the Fourier domain where non-random labeling schemes behave completely differently from random labeling schemes. While signals recoverable from few measurements possess nice spectral properties such as bandlimitedness, fully random stochastic processes are not bandlimited and not recoverable from any finite number of measurements.
Using spectral analysis, we focus on characterizing spectral properties of an underlying distribution which can be exploited by gradient-based methods to converge to generalizable local minima. We address this problem for 2-layer neural networks (see Figure 1a) with sinusoidal activation functions, where we show that if the underlying labeling scheme has limited bandwidth and Fourier $\ell _ { 1 }$ -norm (i.e. "nice" Fourier properties), we expect a gradient-based method to achieve good generalization performance. To arrive at this result, we first develop a Fourier-based generalization bound for 2-layer neural networks in terms of bandwidth and Fourier $\ell _ { 1 }$ -norm. Next, we prove that the local minima found by the gradient descent method over a 2-layer neural network with sine activation have bandwidth and Fourier $\ell _ { 1 }$ -norm bounded in terms of the spectral properties of the underlying labeling scheme.
As a byproduct of our Fourier analysis, we derive generalization bounds for 2-layer neural networks with general activation functions. For bandlimited activation functions with finite Fourier $\ell _ { 1 }$ -norm, such as sinusoidal or Gaussian activation1, our bound is tighter than the generalization bound obtained using only the Lipschitz constant of the activation function. For ReLU-type activation functions, our generalization bound is comparable to Lipschitz-based bounds; however, it leads to a grouped version of the path norms developed in (Neyshabur et al., 2015a). We therefore call this capacity norm group path norm which can be used as an additive penalty to regularize 2-layer neural networks with ReLU activation. Our numerical experiments suggest that the generalization gap can be effectively tightened by regularizing the group path norm. Figure 1b demonstrates how group path norm regularization can help close the generalization gap for both true and random labels.
# 2 RELATED WORK
Generalization has been a topic of central interest in statistical learning theory (Vapnik, 1999; ShalevShwartz & Ben-David, 2014). Generalization bounds have been derived using the stability of a learning algorithm (Bousquet & Elisseeff, 2002) and various complexity measures of a function space such as VC-dimension (Vapnik, 2013) and Rademacher complexity (Bartlett & Mendelson, 2002). (Hardt et al., 2015) develops a stability-based generalization result for SGD as the learning algorithm, which holds for both convex and non-convex loss functions.
We note that spectral analysis has provided a powerful framework for studying neural networks. (Barron, 1993) uses a Fourier-based approach to prove the universal approximation theorem for 2-layer neural networks. Similarly, (Lee et al., 2017) applies Fourier analysis to extend Barron’s result to a general feedforward neural network. (Rippel et al., 2015) uses a spectral approach to model and analyze convolutional neural networks (CNNs) and introduce the spectral pooling scheme for CNNs. Also, our Fourier-based approach to analyze SGD’s performance for 2-layer neural networks follows the same prinicples as the analysis performed in (Shamir, 2016) to prove the hardness of fitting periodic labeling schemes via gradient-based methods. We should note that in this work we use only periodic activation functions and not periodic labeling schemes. Therefore, the hardness result shown in (Shamir, 2016) does not affect our numerical experiments.
In general, theoretical studies of neural networks can be categorized into three main categories: 1) Approximation: Neural networks have been proven to be powerful in expressing a very rich class of functions (Cybenko, 1989) and in general deeper networks need fewer neurons to express the same class of functions (Eldan & Shamir, 2016; Liang & Srikant, 2016). 2) Generalization: Tight bounds have been shown on the VC dimesnion of feedforward neural networks (Anthony & Bartlett, 2009; Harvey et al., 2017). Also, norm-based Rademacher complexity bounds have been developed at (Bartlett & Mendelson, 2002; Neyshabur et al., 2015b). Sharpness of local minima and its connection to their generalizibility have been the focus of several recent works (Keskar et al., 2016; Dinh et al., 2017; Neyshabur et al., 2017) 3) Optimization: theoretical studies have shown both positive (Andoni et al., 2014; Daniely, 2017) and negative (Shalev-Shwartz et al., 2017) results about the performance of gradient-based methods in training neural networks.
# 3 PRELIMINARIES
# 3.1 SUPERVISED LEARNING AND GENERALIZATION
Suppose that we are given $n$ samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ drawn i.i.d. from a population distribution $P _ { \mathbf { X } , Y }$ Here $\mathbf { X }$ denotes the random vector of features and $Y$ denotes the target variable. Using these $n$ samples, the goal of a supervised learner is to find a prediction rule $f$ from a function space $\mathcal { F }$ which can predict $Y$ for an unseen test sample $\mathbf { X }$ . Therefore, given loss function $\ell$ the supervised learner wants to find $f ^ { * } \in { \mathcal { F } }$ minimizing the population risk, defined as $\mathbb { E } \big [ \ell \big ( f ( \mathbf { X } ) , Y \big ) \big ]$ averaged under the population distribution.
However, the supervised learner does not know the population distribution $P _ { \mathbf { X } , Y }$ and has only access to the $n$ training samples. The supervised learner can minimize the empirical risk, defined as $\textstyle 1 / n \sum _ { i = 1 } ^ { n } \ell \bigl ( f ( \mathbf { x } _ { i } ) , \mathbf { \bar { y } } _ { i } \bigr )$ and find $f _ { n } ^ { \mathrm { e m p } }$ . Since we only observe a limited number of samples, the empirical risk would be different from the population risk. The generalization risk, defined for $f \in { \mathcal { F } }$ as $\begin{array} { r l } { } & { { \mathbb E } [ \ell ( f ( \mathbf { X } ) , Y ) ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) } \end{array}$ , is the difference among the population risk and empirical risk for $f$ . Studying the behavior of $f _ { n } ^ { \mathrm { e m p } }$ ’s generalization risk for different function spaces and learning algorithms is a topic of central interest in statistical learning theory.
# 3.2 FOURIER TRANSFORM AND BANDLIMITED FUNCTIONS
Consider a real-valued function $f : \mathbb { R } ^ { k } \mathbb { R }$ . The Fourier transform of this function, which we denote by $\hat { f }$ , is defined as
$${ \widehat { f } } ( \pmb { \xi } ) = \int f ( \mathbf { x } ) \exp \left( - 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } \right) \mathrm { d } \mathbf { x } .$$
Some important examples of Fourier transform are:
• Sinusoidal function: $f ( \mathbf { x } ) = \exp ( 2 \pi i \omega ^ { T } \mathbf { x } )$ , then ${ \widehat { f } } ( \pmb { \xi } ) = \delta ( \pmb { \xi } - \omega )$ where $\delta$ denotes the Dirac delta function, which also implies
• Gaussian function: $f ( \mathbf { x } ) = ( \sqrt { 2 \pi } \sigma ) ^ { k } \exp \bigl ( - \| \mathbf { x } \| _ { 2 } ^ { 2 } / 2 \sigma ^ { 2 } \bigr )$ , then $\widehat { f } ( \pmb { \xi } ) = \exp \left( - \sigma ^ { 2 } \| \pmb { \xi } \| _ { 2 } ^ { 2 } / 2 \right)$ . Thus, the Fourier transform of a Gaussian function preserves the Gaussian shape.
A function $f$ is called $B$ -bandlimited if ${ \widehat { f } } ( \pmb { \xi } ) = 0$ for every $\boldsymbol { \xi }$ where $\| { \pmb \xi } \| _ { 2 } > B$ . The smallest $B$ for which this property holds is called the bandwidth of $f$ . We use $B ( f )$ to denote the bandwidth of function $f$ . We also use $\| { \widehat { f } } \| _ { 1 }$ to denote the $\ell _ { 1 }$ -norm of $f$ ’s Fourier transform,
$$\| { \widehat { f } } \| _ { 1 } = \int | { \widehat { f } } ( \pmb { \xi } ) | \mathrm { d } \pmb { \xi }$$
which we call the Fourier $\ell _ { 1 }$ -norm of $f$ . Fourier $\ell _ { 1 }$ -norm can be interpreted as the absolute volume under $f$ ’s Fourier transform, and is an approximate measure of $\widehat { f }$ ’s sparsity. Fourier $\ell _ { 1 }$ -norm is both scale and shift invariant, i.e. if we define $g ( \mathbf { x } ) = f ( \mathbf { W } \mathbf { x } + \mathbf { b } )$ for a real-valued $f$ and $\mathbf { W } \in \mathbb { R } ^ { r \times k }$ and $\mathbf { b } \in \mathbb { R } ^ { r }$ for some $r \leq k$ , then $\| { \widehat { g } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ . Some other useful properties of Fourier transform are:
• Synthesis: $\begin{array} { r } { f ( \mathbf { x } ) = \int \widehat { f } ( \pmb { \xi } ) \exp \left( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } \right) \mathrm { d } \pmb { \xi } } \end{array}$ , which also implies $\| { \widehat { f } } \| _ { 1 } = f ( 0 )$ if $\widehat { f }$ is real and non-negative. • Shift: $\widehat { f } _ { \mathbf { b } } ( \pmb { \xi } ) = \exp ( 2 \pi i \mathbf { b } ^ { T } \pmb { \xi } ) \widehat { f } ( \pmb { \xi } )$ where $f _ { \mathbf { b } } ( \mathbf { x } ) : = f ( \mathbf { x } - \mathbf { b } )$ , which implies $\| { \widehat { f _ { \mathbf { b } } } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ and $B ( f _ { \mathbf { b } } ) = B ( f )$ . • Derivative: ${ \widehat { \nabla f } } ( \pmb { \xi } ) = 2 \pi i ~ { \widehat { f } } ( \pmb { \xi } ) \pmb { \xi }$ , where $\nabla f$ denotes the gradient of $f$ . • Isometry: $\begin{array} { r } { \int f ( \mathbf { x } ) \overline { { g ( \mathbf { x } ) } } \mathrm { d } \mathbf { x } = \int \widehat { f } ( \pmb { \xi } ) \overline { { \widehat { g } ( \pmb { \xi } ) } } \mathrm { d } \pmb { \xi } } \end{array}$ where $\overline { z }$ denotes the complex conjugate of $z$ . • Convolution: $\widehat { f g } = \widehat { f } \star \widehat { g }$ where $\star$ denotes the convolution operator i.e. ${ \widehat { f } } \star { \widehat { g } } ( \xi ) : = $ $\begin{array} { r } { \int \widehat { f } ( \pmb { \eta } ) \widehat { g } ( \pmb { \xi } - \pmb { \eta } ) \mathrm { d } \pmb { \eta } } \end{array}$ . Therefore, $B ( f g ) \le B ( f ) + B ( g )$ and $\| \widehat { f g } \| _ { 1 } \leq \| \widehat { f } \| _ { 1 } \| \widehat { g } \| _ { 1 }$ .
# 4 A FOURIER-BASED GENERALIZATION BOUND
Consider a supervised learning task with n training samples xi, yini=1 and function space $\mathcal { F }$ . We are interested in uniform convergence bounds on the generalization risk. A standard approach to bound the generalization risk is based on the notion of Rademacher complexity. Given samples $\left( \mathbf { x } _ { i } , y _ { i } \right) _ { i = 1 } ^ { n }$ , the empirical Rademacher complexity of $\mathcal { F }$ is defined as
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) : = \mathbb { E } _ { \pmb { \sigma } } \bigg [ \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } f ( \mathbf { x } _ { i } ) \bigg ]$$
where $\sigma _ { i }$ ’s are i.i.d. random variables uniformly distributed over $\{ - 1 , + 1 \}$ . In fact, the Rademacher complexity of $\mathcal { F }$ measures how well $\mathcal { F }$ can fit some random labels over input $\mathbf { x } _ { i }$ ’s. The following result shows how to bound the generalization risk over $\mathcal { F }$ through its Rademacher complexity.
Theorem 1 (Bartlett & Mendelson (2002)). Consider a $\rho$ -Lipschitz loss function $\ell ( f ( \mathbf { x } ) , y )$ bounded as $| \ell ( z , y ) | \leq c .$ . Then, for any $\delta > 0$ , with probability at least $1 - \delta$
$$\forall f \in \mathcal { F } : \quad \mathbb { E } \big [ \ell ( f ( \mathbf { X } ) , Y ) \big ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) \leq 2 \rho \mathcal { R } _ { n } ^ { \mathrm { e n p } } ( \mathcal { F } ) + 4 c \sqrt { \frac { 2 \log ( 4 / \delta ) } { n } } .$$
Since the Rademacher complexity of norm-bounded linear functions can be appropriately bounded (Kakade et al., 2009), one can effectively apply Theorem 1 to bound generalization risk over normbounded linear functions. To use Theorem 1 in the Fourier domain, here we provide a Rademacher complexity bound for bandlimited functions with bounded Fourier $\ell _ { 1 }$ -norm. We apply the following Rademacher complexity bound to bound generalization risk for 2-layer neural networks in Section 5, and also to analyze the performance of gradient-based methods with sinusoidal activation functions in Section 6.
Theorem 2. Consider function space $\mathcal { F } = \{ \boldsymbol { f } : \mathbb { R } ^ { k } \mathbb { R } $ s.t. $B ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \}$ of $B$ - bandlimited functions with $V$ -bounded Fourier $\mathbf { \dot { \ell } } _ { 1 }$ -norm. Then, the empirical Rademacher complexity for samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ is bounded as
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \sqrt { \frac { 4 k \log \left( 6 4 n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } .$$
Proof. We defer the proof to the Appendix.
Corollary 1. Assume that $\| \mathbf { X } \| _ { 2 } \leq C$ holds almost surely and the loss function $\ell$ is $\rho$ -Lipschitz. Then, for any $\delta > 0$ with probability at least $1 - \delta$ the following generalization bound holds for any $B$ -bandlimited function $f$ with $V$ -bounded Fourier $\ell _ { 1 }$ -norm:
$$\mathbb { E } \big [ \ell ( f ( \mathbf { X } ) , Y ) \big ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) \leq O \bigg ( \rho V \sqrt { \frac { k \log ( n B C / \delta ) } { n } } \bigg ) .$$
Proof. The corrollary is a direct result of applying the bound in Theorem 2 to Theorem 1.
The above corollary bounds the generalization risk uniformly over all bandlimited $f$ ’s such that $B ( f ) \le B$ and $\| { \widehat { f } } \| _ { 1 } \leq V$ . Next, we apply the above results to 2-layer neural networks.
# 5 APPLICATION OF THEOREM 2 TO 2-LAYER NEURAL NETWORKS
Consider a 2-layer neural network including $d$ neurons with activation function $\phi$ in the hidden layer (See Figure 1a). The output of this neural network is
$$f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi ( \mathbf { W } \mathbf { x } + \mathbf { b } ) .$$
If $\phi$ has bounded bandwidth and Fourier $\ell _ { 1 }$ -norm, we can apply Theorem 2 to bound the Rademacher complexity and hence generalization risk over the 2-layer neural network. Here, we use $\| \mathbf { W } \| _ { 2 , \infty }$ to denote the maximum $\ell _ { 2 }$ -norm $\left\| \mathbf { w } _ { i } \right\| _ { 2 }$ among all rows of $\mathbf { W }$ .
Corollary 2. Let $\mathcal { F } _ { \phi } = \left\{ f ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi ( \mathbf { W } \mathbf { x } + \mathbf { b } ) : ~ \| \mathbf { W } \| _ { 2 , \infty } \leq W , ~ \| \mathbf { a } \| _ { 1 } \leq A \right\}$ be the class of 2-layer neural networks where $B ( \phi ) = B$ and $\| \widehat { \phi } \| _ { 1 } = V$ . Then, the empirical Rademacher complexity of $\mathcal { F } _ { \phi }$ for samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ is bounded as follows
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \phi } ) \leq O \biggl ( A V \sqrt { \frac { k \log \bigl ( n B W \operatorname* { m a x } \| \mathbf { x } _ { i } \| _ { 2 } \bigr ) } { n } } \biggr ) .$$
Proof. We defer the proof to the Appendix.
Notice that for bandlimited activation functions with bounded Fourier $\ell _ { 1 }$ -norm, the above generalization bound is increasing logarithmically with $\| \mathbf { W } \| _ { 2 , \infty }$ . For example, this result holds for sinusoidal activation $\phi ( x ) = \sin ( 2 \pi x )$ where $\| \widehat { \phi } \| _ { 1 } = 1$ , $B ( \phi ) = 1$ . On the other hand, the existing Rademacher complexity bounds which use only the Lipschitz constant of the activation function are linear in W’s norm (Bartlett & Mendelson, 2002). Therefore, by exploiting the spectral properties of $\phi$ , Corollary 2 results in a tighter generalization bound than the bounds using only the Lipschitz constant of $\phi$ .
However, an unbounded function such as ReLU $\phi ( x ) = \operatorname* { m a x } ( x , 0 )$ has an infinite Fourier $\ell _ { 1 }$ -norm. Therefore, Corollary 2 does not directly apply to these functions. The following theorem uses a boundedness assumption on input $\mathbf { X }$ to apply Theorem 2 to ReLU-type activation functions. Although the following bound is growing faster than logarithmically with W’s norm, it introduces new capacity norms for 2-layer ReLU-based networks.
Theorem 3. Suppose that $\phi _ { \alpha } ( x ) = \operatorname* { m a x } \{ x , \alpha x \}$ where $\alpha \in [ 0 , 1 ]$ is an arbitrary constant. Consider the pair of dual norms $( \| \cdot \| _ { p } , \| \cdot \| _ { q } )$ where $1 \leq p , q \leq \infty$ and $1 / p + 1 / q = 1$ . Assume that $\| \mathbf { x } _ { i } \| _ { p } \leq C$ holds for all $\mathbf { x } _ { i } \mathbf { \ ' } _ { s . }$ . Then, for $\begin{array} { r } { \mathcal { F } _ { \phi _ { \alpha } } = \left\{ f _ { \mathbf { a } , \mathbf { W } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi _ { \alpha } ( \mathbf { W } \mathbf { x } ) : \sum _ { i = 1 } ^ { d } | a _ { i } | \| \mathbf { w } _ { i } \| _ { q } \leq V \right\} } \end{array}$
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \phi _ { \alpha } } ) \leq O \bigg ( V C \sqrt { \frac { k \log ( n k C ) } { n } } \bigg ) .$$
Proof. We relegate the proof to the Appendix.
The above bound uses the complexity score $\begin{array} { r } { \sum _ { i = 1 } ^ { d } | a _ { i } | \| \mathbf { w } _ { i } \| _ { q } } \end{array}$ for each $f _ { \mathbf { a } , \mathbf { W } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi _ { \alpha } ( \mathbf { W } \mathbf { x } )$ . We can rewrite this complexity score in the following way, which is an $\ell _ { 1 , q }$ -group norm on the product of weights for each path from the input nodes to the output node of the 2-layer neural network,
$$\chi _ { q } \big ( f _ { \mathbf { a } , \mathbf { W } } \big ) = \sum _ { i = 1 } ^ { d } \biggl ( \sum _ { j = 1 } ^ { k } \bigl ( | a _ { i } | | w _ { i , j } | \bigr ) ^ { q } \biggr ) ^ { 1 / q } .$$
Here $w _ { i , j }$ denotes the weight on the link from the $j$ th node of the input layer to the ith node of the hidden layer. Based on the path-norm function defined at (Neyshabur et al., 2015a), we call $\chi _ { q } \left( f _ { \mathbf { a } , \mathbf { w } } \right)$ the group path norm. For $q = 1$ , $\chi _ { 1 }$ -group path norm leads to the $\ell _ { 1 }$ -path norm for 2-layer neural networks. We can use group path norms as an additive regularization penalty to learn over 2-layer neural networks. In our numerical experiments, we test the performance of $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm regularization to control the generalization risk over 2-layer neural networks.
# 6 FOURIER ANALYSIS OF GRADIENT-BASED METHODS FOR 2-LAYER NEURAL NETWORKS WITH SINE ACTIVATION
In this section, we apply Fourier analysis for a 2-layer neural network with sinusoidal activation. We aim to understand the connection between generalizibility of local minima found by gradient-based methods and spectral properties of the population distribution $P _ { \mathbf { X } , Y }$ . As a simplifying assumption, let’s assume that target variable $Y$ is a deterministic function $Y ( \mathbf { \dot { x } } )$ of input $\mathbf { X }$ , which we call the labeling scheme. In our analysis, we consider the squared-error loss $\ell ( y , y ^ { \prime } ) = ( y - y ^ { \prime } ) ^ { 2 }$ .
We specifically ask this question: how can spectral properties of labeling scheme $Y ( \mathbf { x } )$ and population density function $P _ { \mathbf { X } } ( \mathbf { x } )$ affect the generalization performance of a gradient-based method? To address this question, we use a similar strategy to the analysis performed in (Mei et al., 2016) by establishing generalization results for both the empirical risk and the gradient of empirical risk. First, we show that the bandwidth and Fourier $\ell _ { 1 }$ -norm for the local minima of the population risk can be bounded in terms of the bandwidth and Fourier $\ell _ { 1 }$ -norm of $Y ( \mathbf { x } )$ and $P _ { \mathbf { X } } ( \mathbf { x } )$ . Next, we establish a generalization result for the gradient of the empirical risk, proving that the gradient of empirical risk would stay close to the gradient of population risk given that $Y ( \mathbf { x } )$ has limited bandwidth and Fourier $\ell _ { 1 }$ -norm. These two results show that by assuming a labeling scheme with limited bandwidth and Fourier $\ell _ { 1 }$ -norm, the local minima found by the gradient descent (in general large-batch gradient descent) method will generalize well.
# 6.1 POPULATION RISK WITH SINUSOIDAL ACTIVATION
Consider sinusoida $\begin{array} { r } { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \sum _ { j = 1 } ^ { d } a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) } \end{array}$ ing from a 2-layer neural network with the population risk will be $d$ $Y ( \mathbf { x } )$
$$\mathbb { E } _ { P _ { \mathbf { X } } } \left[ \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \right] = \mathbb { E } _ { P _ { \mathbf { X } } } \big [ \big ( Y ( \mathbf { x } ) - \sum _ { j = 1 } ^ { d } a _ { j } \mathrm { s i n } ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) \big ) ^ { 2 } \big ] ,$$
where the expectation is according to the population density function $P _ { \mathbf { X } } ( \mathbf { x } )$ .
Lemma 1. Consider the population risk in (11). Assume $\mathbf { w } _ { j }$ satisfies $\forall i \neq j : \operatorname* { m i n } \{ \| \mathbf { w } _ { i } - { }$ $\mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { i } + \mathbf { w } _ { j } \| _ { 2 } \big \} > B ( P _ { \mathbf { X } } )$ . Then, $i f ( \mathbf { a } , \mathbf { W } , \mathbf { b } )$ is assumed to be a local minimum of the population risk,
$$\big | a _ { j } \big | \leq 2 \big | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big | .$$
Proof. We defer the proof to the Appendix.
Lemma 1 says that if the component $a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } )$ becomes isolated for a local minimum, by which we mean there are no other component $a _ { i } \sin ( 2 \pi \mathbf { w } _ { i } ^ { T } \mathbf { x } )$ with $\operatorname* { m i n } \{ \| \mathbf { w } _ { i } - \mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { i } + \mathbf { w } _ { j } \| _ { 2 } \}$ less than $P _ { \mathbf { X } }$ ’s bandwidth, then the value of $a _ { j }$ for that local minimum is nicely bounded in terms of the population distribution. This result leads to the following Theorem which describes the Fourier properties of the local minima of the population risk.
Theorem 4. Consider the minimization problem of the population risk (11). If a local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } )$ satisfies the isolated components condition, i.e. for any two different $i , j$ we have $\operatorname* { m i n } \bigl \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 B ( P _ { \mathbf { X } } )$ , then for the local minimum function $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$
$$\begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } . } \end{array}$$
Proof. We defer the proof to the Appendix.
Theorem 4 implies that the bandwidth of the local minima of the population risk is less than the sum of bandwidths for $Y$ and $P _ { \mathbf { X } }$ . Also, the Fourier $\ell _ { 1 }$ -norm for the local minima of the population distribution is bounded by twice the Fourier $\ell _ { 1 }$ -norm of $Y$ .
Remark 1. To apply Theorem 4, the bandwidth of $P _ { \mathbf { X } }$ needs to be smaller than half the distance among $\mathbf { w } _ { i } ^ { * }$ ’s. For example, suppose that $\mathbf { X } \sim { \mathcal { N } } ( { \pmb { \mu } } , \sigma ^ { 2 } \mathbf { I } _ { k \times k } )$ has a multivariate Gaussian distribution with mean $\pmb { \mu }$ and diagonal covariance matrix with standard deviation $\sigma$ . Then, the above theorem shows that if for any $i , j$ we have $\operatorname* { m i n } \bigr \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 C / \sigma$ for some constant $C$ then
$$\begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + O \big ( \sqrt { k } / \sigma \big ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 ( 1 + d \exp ( - C ^ { 2 } / 2 ) ) \| \widehat { Y } \| _ { 1 } . } \end{array}$$
Proof. See the proof of Theorem 4 in the Appendix.
# 6.2 GENERALIZATION TO THE EMPIRICAL RISK
Theorem 4 characterizes the Fourier properties of the local minima for the population risk. However, we want to investigate the generalization performance of the local minima of the empirical risk defined for training samples $\mathbf { \bar { \rho } } ( \mathbf { x } _ { i } , Y ( \mathbf { x } _ { i } ) ) _ { i = 1 } ^ { n }$ as
$$\frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } _ { i } ) , Y ( \mathbf { x } _ { i } ) \big ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \bigg ( Y ( \mathbf { x } _ { i } ) - \sum _ { j = 1 } ^ { d } a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } _ { i } + b _ { j } ) \bigg ) ^ { 2 } .$$
To address this question, note that the bandwidth and Fourier $\ell _ { 1 }$ -norm of the loss’s gradient with respect to each $a _ { j }$ are bounded in terms of the bandwidth and Fourier $\ell _ { 1 }$ -norm of $Y ( \mathbf { x } )$ as
$$\begin{array} { r l } & { \quad \big \| \nabla _ { a _ { j } } \ell \big ( \widehat { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \big \| _ { 1 } \leq \| \widehat { Y } \| _ { 1 } + \| \mathbf { a } \| _ { 1 } , } \\ & { \mathcal { B } \big ( \nabla _ { a _ { j } } \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \big ) \leq \mathcal { B } ( Y ) + 2 \| \mathbf { W } \| _ { 2 , \infty } . } \end{array}$$
We can apply Corollary 1 to show that not only the empirical risk uniformly converges to the population risk but also the gradient of the empirical risk will stay close to the gradient of the population risk.
Corollary 3. Consider $\begin{array} { r } { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \sum _ { j = 1 } ^ { d } a _ { j } \sin ( \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) } \end{array}$ and squared error loss \`. Then, given that $\| \mathbf { X } \| _ { 2 } \leq C$ , for any $\delta > 0$ with probability at least $1 - \delta$ we have
$\forall j , \mathbf { a } , \mathbf { W } , \mathbf { b }$ s.t. $\| \mathbf { a } \| _ { 1 } + \| { \widehat { Y } } \| _ { 1 } \leq V , \ 2 \| \mathbf { W } \| _ { 2 , \infty } + B ( Y ) \leq B \ :$
$$\begin{array} { r l } & { \displaystyle \mathbb { E } [ \nabla _ { a _ { j } } \ell ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) ) ) ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } [ \nabla _ { a _ { j } } \ell ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } _ { i } ) , Y ( \mathbf { x } _ { i } ) ) ) ] \Big \vert \leq O \big ( V \sqrt { \frac { k \log ( n B C / \delta ) } { n } } \big ) . } \end{array}$$
Proof. The corollary is a direct result of Corollary (1) given (14) and (15). Note that the generalization bound holds with probability $1 - \delta$ for the derivative with respect to all $a _ { j }$ ’s, since the bounds in (14) and (15) hold for all $j$ ’s. □
We emphasize that to prove Theorem 4 we need to analyze the risk function’s derivative only with respect to $a _ { j }$ ’s. Hence, generalization of the empirical risk’s gradient with respect to $a _ { j }$ ’s, which is shown in the above corollary under certain assumptions, is sufficient to apply an approximate version of Theorem 4 in section 8.6 to a local minimum $( { \bf a } ^ { * } , { \bf W } ^ { * } , { \bf b } ^ { * } )$ satisfying the isolated components assumption and found by the gradient descent approach initialized at a low $\left\| \mathbf { a } \right\| _ { 1 }$ and $\lVert \mathbf { W } \rVert _ { 2 , \infty } ^ { - }$ . We can conclude that with probability at least $1 - \delta$ the $\ell _ { 1 }$ -norm of $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ ’s Fourier transform outside the bandwidth $\mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } )$ is bounded by $O \big ( d V \sqrt { \frac { k \log \big ( n B C / \delta \big ) } { n } } \big )$ , and also
 Figure 2: Training an test performance on cat and airplane CIFAR10 images with true and random labels. Sine activation and mean-squared-error loss were used.
 Figure 3: Training and test performance on cat and airplane CIFAR10 images with true and random labels. ReLU activation and cross-entropy loss were used.
$$\| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } + O \big ( d V \sqrt { \frac { k \log ( n B C / \delta } { n } } \big ) .$$
Based on the above discussion, if a large-batch gradient descent method starts learning from $f _ { \mathbf { a } , \mathbf { w } , \mathbf { b } }$ with low $\lVert \mathbf { a } \rVert _ { 1 }$ and $\| \mathbf { W } \| _ { 2 , \infty }$ and also we assume that the bandwidth and the Fourier $\ell _ { 1 }$ -norm for $Y ( \mathbf { x } )$ are properly bounded, Theorem 4 combined with Corollary 1 will guarantee good generalization performance for the local minima found by the gradient descent method.
# 7 NUMERICAL EXPERIMENTS
For all experiments described in this section, we implemented and trained the two-layer neural network described in Figure 1a using TensorFlow 1.3.0. We used SGD to train the model for 2000 epochs with an initial learning rate of 0.01. The learning rate decayed slightly each epoch at a rate of 0.95 every 390 epochs. We used $h = 5 1 2$ hidden units and a batch size of 128. When working with CIFAR10 data, we preprocessed the data as described in (Zhang et al., 2016), resulting in each training sample having dimension $d = 2 3 5 2$ . Initial weights from the first layer were sampled from $\mathcal { N } ( 0 , \bar { 0 . 0 1 } / \bar { d } )$ and initial weights from the second layer were sampled from $\dot { \mathcal { N } } ( 0 , 0 . 0 1 / h )$ .
7.1 SGD GRADUALLY LEARNS HIGHER FOURIER $\ell _ { 1 }$ -NORM, BANDWIDTH HYPOTHESES
We first numerically demonstrate that how Fourier $\ell _ { 1 }$ -norm and bandwidth both increases during training via SGD. Motivated by the analysis from Section 6, we use the squared-error as our loss function and sine as our activation function. Our samples consist of cats and airplanes from the CIFAR10 dataset with the labels mapped to $- 1$ and 1. We use 5000 and 2000 samples from each category for training and test, respectively. We arbitrarily chose two of the ten classes to accommodate our choice of loss function. We evaluate the network’s performance for both random and true labels.
Figure 2a shows that without regularization, SGD learns to perfectly fit both the true and random labels, which is consistent with the results from Zhang et al. (2016). Additionally, the random labels are harder to learn, requiring more epochs before achieving a perfect fit. Figures 2b and 2c confirm that both Fourier $\ell _ { 1 }$ -norm and bandwidth consistently increase with training, highlighting how SGD gradually finds more complex hypotheses in order to fit the data. Finally, we see in figures 2d and 2e how both Fourier $\ell _ { 1 }$ -norm and bandwidth increase with generalization risk (the difference between test mean squared-error (MSE) and training MSE) with almost perfect correlation. This suggests that, as implied by the theory above, regularizing Fourier $\ell _ { 1 }$ -norm and bandwidth could improve generalizability of the final learned model.
# 7.2 GROUP PATH NORM REGULARIZATION FOR RELU ACTIVATION
We regularize group path norm for ReLU activation as motivated by Theorem 3. Although $\chi _ { 2 }$ -group path norm is not convex, it is differentiable and we can use it as an additive penalty and find a local minimum via SGD. Using the same experimental setup as from section 7.1, we swap sine for ReLU and test the network’s performance for both random and true labels.
Figure 3a confirms that, like before, the network can fit both true and random labels. The generalization gap, however, remains large for random labels. By regularizing the $\ell _ { 2 }$ -norm of all the weights, we see that the generalization gap closes for both the true labels and the random labels without compromising test accuracy significantly (Figure 3b). This result is further improved when we use the $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm (Figure 3c and 3d), demonstrating that direct regularization of Fourier $\ell _ { 1 }$ -norm leads to better generalization.
We cross-validated the value of $\lambda$ for each regularization technique, and we chose the $\lambda$ that resulted in the smallest generalization gap with comparable validation performance. To fairly compare different regularization strategies, we tested five lambda values for each strategy and then reported the performance on the test set for the lambda value that resulted in the best performance on the validation set.
We repeated the experiment using all 50000 CIFAR10 training samples (and 10000 test samples). We included all 10 classes and switched to cross-entropy loss. The results are shown in Figure 1b. Again, we see that while all regularization techniques give similar test performance, the generalization gap is closed significantly for the $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm.
# REFERENCES
Alexandr Andoni, Rina Panigrahy, Gregory Valiant, and Li Zhang. Learning polynomials with neural networks. In International Conference on Machine Learning, pp. 1908–1916, 2014. Martin Anthony and Peter L Bartlett. Neural network learning: Theoretical foundations. cambridge university press, 2009. Andrew R Barron. Universal approximation bounds for superpositions of a sigmoidal function. IEEE Transactions on Information theory, 39(3):930–945, 1993. Peter Bartlett, Dylan J Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1706.08498, 2017. Peter L Bartlett and Shahar Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002. Olivier Bousquet and André Elisseeff. Stability and generalization. Journal of Machine Learning Research, 2 (Mar):499–526, 2002.
Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pp. 160–167, 2008.
George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989.
Amit Daniely. Sgd learns the conjugate kernel class of the network. arXiv preprint arXiv:1702.08503, 2017.
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. arXiv preprint arXiv:1703.04933, 2017.
John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
Ronen Eldan and Ohad Shamir. The power of depth for feedforward neural networks. In Conference on Learning Theory, pp. 907–940, 2016.
Moritz Hardt, Benjamin Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. arXiv preprint arXiv:1509.01240, 2015.
Nick Harvey, Chris Liaw, and Abbas Mehrabian. Nearly-tight vc-dimension bounds for piecewise linear neural networks. arXiv preprint arXiv:1703.02930, 2017.
Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6): 82–97, 2012.
Sham M Kakade, Karthik Sridharan, and Ambuj Tewari. On the complexity of linear prediction: Risk bounds, margin bounds, and regularization. In Advances in neural information processing systems, pp. 793–800, 2009.
Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016.
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
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.
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
Holden Lee, Rong Ge, Andrej Risteski, Tengyu Ma, and Sanjeev Arora. On the ability of neural nets to express distributions. arXiv preprint arXiv:1702.07028, 2017.
Shiyu Liang and R Srikant. Why deep neural networks? arXiv preprint arXiv:1610.04161, 2016.
Song Mei, Yu Bai, and Andrea Montanari. The landscape of empirical risk for non-convex losses. arXiv preprint arXiv:1607.06534, 2016.
Behnam Neyshabur, Ruslan R Salakhutdinov, and Nati Srebro. Path-sgd: Path-normalized optimization in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2413–2421, 2015a.
Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. In COLT, pp. 1376–1401, 2015b.
Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring generalization in deep learning. arXiv preprint arXiv:1706.08947, 2017.
Oren Rippel, Jasper Snoek, and Ryan P Adams. Spectral representations for convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 2449–2457, 2015.
Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
Shai Shalev-Shwartz, Ohad Shamir, and Shaked Shammah. Failures of gradient-based deep learning. In International Conference on Machine Learning, pp. 3067–3075, 2017.
Ohad Shamir. Distribution-specific hardness of learning neural networks. arXiv preprint arXiv:1609.01037, 2016.
Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013.
Vladimir N Vapnik. An overview of statistical learning theory. IEEE transactions on neural networks, 10(5): 988–999, 1999.
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
# 8 APPENDIX
# 8.1 PROOF OF THEOREM 2
We use a high-dimensional grid in the Fourier domain to approximate the Fourier transform of a $B$ -bandlimited function. Consider the ball $\displaystyle \mathbf { \bar { \boldsymbol { \{ \xi } } } \colon \| \pmb { \xi } \| _ { 2 } \leq B \}$ . Using the bounds on the covering number for $\ell _ { 2 }$ -norm, for any $0 < \epsilon < B$ we can find a set of points $\{ \pmb { \xi } _ { j } : 1 \le j \le ( 3 B / \epsilon ) ^ { k } \}$ such that for any $\pmb { \xi }$ with $\| { \pmb { \xi } } \| _ { 2 } \le B$ , there exists some $\xi _ { j }$ with $\| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \le \epsilon$ .
Let $S _ { j } = \{ \pmb { \xi } : \| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \leq \epsilon \}$ for each $1 \le j \le ( 3 B / \epsilon ) ^ { k }$ . Note that $\{ \pmb { \xi } : \ \| \pmb { \xi } \| _ { 2 } \le B \} \subset \cup _ { j } S _ { j }$ . We then define $S _ { j } ^ { \prime } = S _ { j } \setminus \cup _ { t = 1 } ^ { j - 1 } S _ { t }$ to have a group of disjoint sets $S _ { j } ^ { \prime }$ covering $\{ \pmb { \xi } : \ \| \pmb { \xi } \| _ { 2 } \leq B \}$ . Since any $f \in { \mathcal { F } }$ is assumed to be $B$ -bandlimited, for $f \in { \mathcal { F } }$
$$\begin{array} { l } { f ( \mathbf { x } ) = \displaystyle \int \widehat { f } ( \pmb { \xi } ) \exp ( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } ) \mathrm { d } \pmb { \xi } } \\ { = \displaystyle \sum _ { j = 1 } ^ { ( 3 B / \epsilon ) ^ { k } } \int _ { \pmb { \xi } \in S _ { j } ^ { \prime } } \widehat { f } ( \pmb { \xi } ) \exp ( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } ) \mathrm { d } \pmb { \xi } . } \end{array}$$
Then, for any $f \in { \mathcal { F } } = \{ f : { \mathcal { B } } ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \}$ we have
$$\begin{array} { r l } | | \begin{array} { l l } { f ( \Phi ) } & { - \frac { \lambda ( \xi ) \xi } { 2 } [ \exp ( \xi ) \log ( \xi ) ] | _ { \xi = \xi } | \langle \Phi \rangle | } \\ & { + | \frac { \lambda ( \xi ) \xi } { 2 } [ \exp ( \xi ) \log ( \xi ) ] | _ { \xi = \xi } | \langle \Phi \rangle | _ { \xi = \xi } | } \\ & { - | \frac { \lambda ( \xi ) \xi } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi \xi ] [ \log ( \xi ) ) + \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] ] | _ { \xi = \xi } ^ { \xi } } \\ & { \le \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] [ \xi ] [ \lambda ( \xi ) ) [ \xi ] [ \xi ] ] ] | _ { \xi = \xi } ^ { \xi } [ \xi ] [ \xi ] | _ { \xi = \xi } ^ { \xi } } \\ & { \overset { \mathrm { B ( a ) } } { \le } \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] [ \xi ] \xi ] [ \xi - \xi ] \xi ] \le \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] \frac { \lambda ( \xi ) } { 2 } } \\ & { \le \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] \xi ] [ \xi ] \xi [ \xi ] \xi [ \xi ] \xi [ \xi ] \xi ] \ } \\ & { \overset { \mathrm { C ( I ) } } { \le } \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] \xi ] [ \xi ] \xi [ \xi ] \xi ] \xi } \\ & \overset { \mathrm { B ( a ) } } { \le } \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } \frac { \lambda ( \xi ) } { 2 } \int _ \xi \ \end{array} \end{array}$$
Here, (a) is a direct application of (17). (b) holds as $\exp ( i b z ) = \cos ( b z ) + i \sin ( b z )$ is $^ { b }$ -Lipschitz as a function of $z \in \mathbb { R }$ for any real number $b > 0$ . (c) holds because according to our definitions $\bar { S _ { j } ^ { \prime } } \subseteq S _ { j }$ and $S _ { j } = \{ \pmb { \xi } : \ \| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \leq \epsilon \}$ .
Therefore, the following function space $\mathcal { F } _ { \epsilon }$ can approximate any $f \in { \mathcal { F } } = \left\{ f : { \mathcal { B } } ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \right\}$ within $2 \pi \epsilon C V$ accuracy for any $\| \mathbf { x } \| _ { 2 } \leq C$ . Here a is, in general, a vector of complex numbers, and $\begin{array} { r } { \| \dot { \bf a } \| _ { 1 } : = \sum _ { j } | a _ { j } | } \end{array}$
where $| z |$ denotes the absolute value of complex number $z$
$$\mathcal { F } _ { \epsilon } = \Bigg \{ f ( \mathbf { x } ) = \sum _ { j = 1 } ^ { ( 3 B / \epsilon ) ^ { k } } a _ { j } \exp ( 2 \pi i \pmb { \xi } _ { j } ^ { T } \mathbf { x } ) : \| \mathbf { a } \| _ { 1 } \leq V \Bigg \} .$$
Then, $\mathcal { F } _ { \epsilon }$ is the space of $\ell _ { 1 }$ -norm bounded linear functions in terms of the input vector $\left[ \exp ( 2 \pi i \pmb { \xi } _ { j } ^ { T } \mathbf { x } ) \right] _ { j }$ . Now, we can apply a well-known bound (Shalev-Shwartz & Ben-David, 2014) on the Rademacher complexity of $\ell _ { 1 }$ -norm bounded linear space $\mathcal { F } _ { \mathrm { l i n } , 1 } = \{ \boldsymbol { f } : \mathbb { R } ^ { k } \mathbb { R } $ s.t. $f ( \mathbf { x } ) = \mathbf { a } ^ { T } \mathbf { x }$ , $\| \mathbf { a } \| _ { 1 } \leq A \}$ as
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \mathrm { l i n } , 1 } ) \leq A \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { \infty } \sqrt { \frac { 2 \log ( 2 k ) } { n } } .$$
Applying the above bound, we can bound the Rademacher complexity of $\mathcal { F } _ { \epsilon }$ as
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \epsilon } ) \leq V \sqrt { \frac { 2 k \log ( 6 B / \epsilon ) } { n } } .$$
Since for each $f \in { \mathcal { F } }$ there exists $\tilde { f } \in \mathcal { F } _ { \epsilon }$ such that $\forall \| \mathbf { x } \| _ { 2 } \leq C : | f ( \mathbf { x } ) - \tilde { f } ( \mathbf { x } ) | \leq 2 \pi \epsilon C V$ ,
$$\begin{array} { r l } { { \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) = \mathbb { E } _ { \sigma } \bigg [ \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } f ( \mathbf { x } _ { i } ) \bigg ] } \quad } & { } \\ & { \leq \mathbb { E } _ { \sigma } \bigg [ \operatorname* { s u p } _ { \tilde { f } \in \mathcal { F } _ { \epsilon } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } \tilde { f } ( \mathbf { x } _ { i } ) \bigg ] + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } } \\ & { = \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \epsilon } ) + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } . } \end{array}$$
Finally, combining (20) and (21) we obtain:
$$\forall \epsilon > 0 : \quad \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \sqrt { \frac { 2 k \log ( 6 B / \epsilon ) } { n } } + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } .$$
If we choose the value $\begin{array} { r } { \epsilon = \frac { 1 } { 2 \pi n \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } } } \end{array}$ , then we get
$$\begin{array} { r l } & { \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \bigg ( \sqrt { \frac { 2 k \log \left( 1 2 \pi n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } + \frac { 1 } { n } \bigg ) } \\ & { \qquad \leq V \sqrt { \frac { 4 k \log \left( 1 2 \pi n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) + 2 / n } { n } } } \\ & { \qquad \leq V \sqrt { \frac { 4 k \log \left( 6 4 n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } , } \end{array}$$
where the last inequality follows from the fact that $1 \leq k , n$ . Therefore, the proof is complete.
# 8.2 PROOF OF COROLLARY 2
First, we prove the following lemma.
Lemma 2. Given function $f : \mathbb { R } ^ { k } \mathbb { R }$ and matrix $\mathbf { W } \in \mathbb { R } ^ { k \times k }$ , we define $g ( \mathbf { x } ) = f ( \mathbf { W } \mathbf { x } )$ . Then,
• $B ( g ) \leq \| \mathbf { W } \| _ { 2 } B ( f )$ with $\| \mathbf { W } \| _ { 2 }$ denoting the spectral norm of $\mathbf { W }$ , • $\| { \widehat { g } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ .
Proof. From the properties of the Fourier transform we know
$$\widehat { g } ( \pmb { \xi } ) = \frac { 1 } { | \operatorname* { d e t } ( \mathbf { W } ) | } \widehat { f } \big ( \mathbf { W } ^ { - T } \pmb { \xi } \big ) .$$
Therefore, $\begin{array} { r } { \widehat { g } ( \mathbf { W } ^ { T } \pmb { \xi } ^ { \prime } ) = \frac { 1 } { | \operatorname* { d e t } ( \mathbf { W } ) | } \widehat { f } \big ( \pmb { \xi } ^ { \prime } \big ) } \end{array}$ and if $\| \pmb { \xi } ^ { \prime } \| _ { 2 } \le B ( f )$ , then $\| \mathbf { W } ^ { T } \pmb { \xi } ^ { \prime } \| _ { 2 } \le \| \mathbf { W } \| _ { 2 } B ( f )$ gives an upperbound on $B ( g )$ . Also,
$$\begin{array} { r l } & { \| \hat { g } \| _ { 1 } = \int \big | \hat { g } ( \xi ) \big | \mathrm { d } \xi } \\ & { \quad = \int \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \big | \widehat { f } ( \mathbf { W } ^ { - T } \xi ) \big ) \big | \mathrm { d } \xi } \\ & { \quad = \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \int \big | \widehat { f } ( \mathbf { W } ^ { - T } \xi ) \big | \mathrm { d } \xi } \\ & { \quad = \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \int \big | \widehat { f } ( \xi ^ { \prime } ) \big ) \big | \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ^ { - T } \setminus j ) \big | } \mathrm { d } \xi ^ { \prime } } \\ & { \quad = \int \big | \widehat { f } ( \xi ^ { \prime } ) \big | \mathrm { d } \xi ^ { \prime } } \\ & { \quad = \| \widehat { f } \| _ { 1 } . } \end{array}$$
It can be seen that this result remains valid even if $\mathbf { W }$ is not an invertible matrix, which will complete the proof for Corollary 2. However, we continue proving Corollary 2 without using this fact.
As shown in the above lemma, Fourier $\ell _ { 1 }$ -norm and bandwidth are invariant to an orthonormal transformation $\mathbf { W }$ . Given $f _ { i } ( \mathbf { x } ) = a _ { i } \phi ( \mathbf { w } _ { i } ^ { T } \mathbf { x } )$ , we define $g _ { i } ( { \bf x } ) = f _ { i } ( { \bf A } _ { i } { \bf x } )$ where $A _ { i }$ is an orthonormal matrix with ${ \bf w } _ { i }$ as an eigenvector. Note that $\lVert \widehat { f } _ { i } \rVert _ { 1 } = \lVert \widehat { g _ { i } } \rVert _ { 1 }$ and $B ( f _ { i } ) \ : = \ : B ( g _ { i } )$ . However, $g _ { i } ( \mathbf { x } )$ is a function of only bone of the coordinates, which we can assume, without loss of generality, to be the first coordinate. Hence, $g _ { i } ( \mathbf { x } ) = a _ { i } \phi ( \| \mathbf { w } _ { i } \| _ { 2 } x _ { 1 } )$ for the first coordinate $x _ { 1 }$ , implying $\begin{array} { r } { \widehat { g _ { i } } ( \pmb { \xi } ) = \frac { a _ { i } } { \| \mathbf { w } _ { i } \| _ { 2 } } \widehat { \phi } ( \frac { \xi _ { 1 } } { \| \mathbf { w } _ { i } \| _ { 2 } } ) . \delta _ { 2 } ( \xi _ { 2 } ) \ldots \delta _ { k } ( \xi _ { k } ) } \end{array}$ $\delta _ { j }$ is the Dirac delta function across the $j$ th dimension. Hence, we can use the above lemma in the 1-dimensional case to show $\| \widehat { g _ { i } } \| _ { 1 } = | a _ { i } | \| \widehat { \phi } \| _ { 1 }$ and $B ( g _ { i } ) = \| \mathbf { w } _ { i } \| _ { 2 } B ( \phi )$ . As a result,
$$\| \widehat { f } _ { i } \| _ { 1 } = | a _ { i } | \| \widehat { \phi } \| _ { 1 } , \quad \mathcal { B } ( f _ { i } ) \leq \| \mathbf { w } _ { i } \| _ { 2 } \mathcal { B } ( \phi ) .$$
Hence, for $\begin{array} { r } { f ( \mathbf { x } ) = \mathbf { a } ^ { T } \boldsymbol { \phi } ( \mathbf { W } \mathbf { x } + \mathbf { b } ) = \sum _ { i = 1 } ^ { d } a _ { i } \boldsymbol { \phi } ( \mathbf { w } _ { i } ^ { T } \mathbf { x } + b _ { i } ) } \end{array}$ we have
$$\| \widehat { f } \| _ { 1 } \leq \| \mathbf { a } \| _ { 1 } \| \widehat { \phi } \| _ { 1 } , \quad \mathcal { B } ( f ) \leq \| \mathbf { W } \| _ { 2 , \infty } \mathcal { B } ( \phi ) .$$
The corollary is then a direct application of Theorem 2.
# 8.3 PROOF OF THEOREM 3
Given a ReLU-type activation function $\phi _ { \alpha } ( z ) = \operatorname* { m a x } \{ z , \alpha z \}$ ,
$$\phi _ { \alpha } \big ( \mathbf { w } ^ { T } \mathbf { x } \big ) = \| \mathbf { w } \| _ { q } \phi _ { \alpha } \big ( ( \frac { \mathbf { w } } { \| \mathbf { w } \| _ { q } } ) ^ { T } \mathbf { x } \big ) .$$
Since ${ \left\| \frac { \mathbf { w } } { \left\| \mathbf { w } \right\| _ { q } } \right\| } _ { q } = 1$ , if $\| \mathbf { x } \| _ { p } \leq C$ , then ${ \Big | } { \big ( } { \frac { \mathbf { w } } { \| \mathbf { w } \| _ { q } } } { \big ) } ^ { T } \mathbf { x } { \Big | } \leq C$ and hence the input to $\phi _ { \alpha }$ in the R.H.S. of (28) is always between $- C$ and $C$ .
Suppose that function $\psi _ { \alpha }$ satisfies $\psi _ { \alpha } ( z ) = \phi _ { \alpha } ( z )$ for $z \in [ - C , C ]$ . Then, based on the above discussion, we can bound the Rademacher complexity of ${ \mathcal F } _ { \phi _ { \alpha } }$ by finding a bound on the Rademacher complexity of $\mathcal { F } _ { \psi _ { \alpha } } = \left\{ f _ { \mathbf { v } , \mathbf { U } } ( \mathbf { x } ) = \mathbf { v } ^ { T } \psi _ { \alpha } ( \mathbf { U } \mathbf { x } ) : ~ \| \mathbf { v } \| _ { 1 } \leq V , \forall i : ~ \| \mathbf { u } _ { i } \| _ { q } = 1 \right\}$ .
To find a good candidate for $\psi _ { \alpha }$ , we use a symmetrization trick to define
$$\psi _ { \alpha } ( z ) = \left\{ \begin{array} { c l } { - \alpha C } & { \mathrm { i f } z < - C , } \\ { \phi _ { \alpha } ( z ) } & { \mathrm { i f } - C \le z < C , } \\ { \phi _ { \alpha } ( 2 C - z ) } & { \mathrm { i f } C \le z < 3 C , } \\ { - \alpha C } & { \mathrm { i f } 3 C \le z . } \end{array} \right.$$
Note that $\begin{array} { r } { \psi _ { \alpha } ( z ) = ( 1 - \alpha ) C h ( \frac { z - C } { C } ) + 2 \alpha C h ( \frac { z - C } { 2 C } ) - \alpha C } \end{array}$ where $h ( z ) = \operatorname* { m a x } \{ 0 , 1 - | z | \} .$ . It can be seen that $\begin{array} { r } { { \widehat { h } } ( \xi ) = \big ( \frac { \sin ( \pi \xi ) } { \pi \xi } \big ) ^ { 2 } } \end{array}$ which is real and positive everywhere. Therefore, $\| \widehat { h } \| _ { 1 } = h ( 0 ) = 1$ which means that $\| \widehat { \psi _ { \alpha } } \| _ { 1 } \leq C ( 1 + 2 \alpha ) \leq 3 C .$ .
Since $\vert \widehat { h } ( \xi ) \vert \le \frac { 1 } { \xi ^ { 2 } }$ , we have $\widehat { | \psi _ { \alpha } ( \xi ) | } \le \frac { 1 } { \xi ^ { 2 } }$ . For $B > 0$ , we let the $B$ -filtered $\psi _ { \alpha , B }$ be a function with the following Fourier transform:
$$\widehat { \psi _ { \alpha , B } } ( \xi ) = \left\{ \begin{array} { l l } { \widehat { \psi _ { \alpha } } ( \xi ) } & { \mathrm { i f ~ } | \xi | \leq B } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.$$
Then, since $\bigl | \widehat { \psi _ { \alpha } } ( \xi ) \bigr | \le \frac { 1 } { \xi ^ { 2 } }$ we have
$$\forall z \in \mathbb { R } : \quad \left| \psi _ { \alpha } ( z ) - \psi _ { \alpha , B } ( z ) \right| \leq \int _ { | \xi | \geq B } \left| \widehat { \psi _ { \alpha } } ( \xi ) \right| \mathrm { d } \xi \leq \frac { 2 } { B } .$$
Thus, for any $B > 0$ the defined $\psi _ { \alpha , B }$ approximates $\phi _ { \alpha }$ with a maximum error of $\frac { 2 } { B }$ uniformly over $[ - C , C ]$ . $\psi _ { \alpha , B }$ also satisfies $\| \widehat { \psi _ { \alpha , B } } \| _ { 1 } \leq 3 C$ and $\begin{array} { r } { B ( \psi _ { \alpha , B } ) = B } \end{array}$ . Applying Corollary 2, we get
$$\forall B > 0 : \quad \mathcal { R } _ { n } ^ { \mathrm { e m p } } \big ( \mathcal { F } _ { \phi _ { \alpha } } \big ) \leq O \Bigg ( V C \sqrt { \frac { k \log \left( n B \operatorname* { m a x } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } \Bigg ) + \frac { 2 } { B } .$$
Here we can bound m $\begin{array} { r } { \mathrm { a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \leq \sqrt { k } \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { \infty } \leq \sqrt { k } C } \end{array}$ , and choose $B = n$ to get
$$\mathcal { R } _ { n } ^ { \mathrm { e m p } } \big ( \mathcal { F } _ { \phi _ { \alpha } } \big ) \leq O \bigg ( V C \sqrt { \frac { k \log \big ( n k C \big ) } { n } } + \frac { 1 } { n } \bigg ) ,$$
which completes the proof.
# 8.4 PROOF OF LEMMA 1
Note that
$$\begin{array} { r l } { \overset { \_ } { \nabla } _ { \mathbf { X } _ { 3 } } \left[ \ell \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \right] = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \nabla _ { a _ { j } } \ell \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \right] } & { } \\ & { = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \nabla _ { a _ { j } } \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) - Y ( \mathbf { X } ) \big ) ^ { 2 } \right] } \\ & { = \mathbb { E } _ { P _ { \mathbf { Y } } } \left[ 2 \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \big ( \underset { t = 1 } { \overset { d } { \sum } } a _ { t } \sin ( 2 \pi \mathbf { w } _ { t } ^ { T } \mathbf { X } + b _ { t } ) - Y ( \mathbf { X } ) \big ) \right] } \\ & { = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ 2 a _ { j } \sin ^ { 2 } ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \right] - \mathbb { E } _ { P _ { \mathbf { X } } } \left[ 2 \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) Y ( \mathbf { X } ) \right] } \\ & { \ + \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \underset { t \neq j } { \sum } 2 a _ { t } \sin ( 2 \pi \mathbf { w } _ { t } ^ { T } \mathbf { X } + b _ { t } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \right] } \\ & { = a _ { j } - 2 \left[ \cos ( b _ { j } ) \ln \big \{ \hat { Y } * \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big \} + \sin ( b _ { j } ) \mathrm { R e } \big \{ \hat { Y } * \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big \} \right] . } \end{array}$$
To show the last equality, we use the isolatedness assumption for $\mathbf { w } _ { j }$ , i.e. $\forall t \neq j : \operatorname* { m i n } \{ \| \mathbf { w } _ { t } - \mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { t } +$ $\mathbf { w } _ { j } \| _ { 2 } \big \} > B ( P \mathbf { x } )$ , and also $\| \mathbf { w } _ { j } \| _ { 2 } \geq B ( P \mathbf { x } ) / 2$ . Then, for each $t$
$$\begin{array} { r l } { \mathbb { E } _ { P \mathbf x } \left[ 2 \sin ( 2 \pi \mathbf w _ { t } ^ { T } \mathbf X + b _ { t } ) \sin ( 2 \pi \mathbf w _ { j } ^ { T } \mathbf X + b _ { t } ) \right] = 2 \int P \mathbf x ( \mathbf x ) \sin ( 2 \pi \mathbf w _ { t } ^ { T } \mathbf x + b _ { t } ) \sin ( 2 \pi \mathbf w _ { j } ^ { T } \mathbf x + b _ { t } ) \mathrm { d } \mathbf x } & { } \\ { = } & { \int P \mathbf x ( \mathbf x ) \biggl [ \cos ( 2 \pi ( \mathbf w _ { t } - \mathbf w _ { s } ) ^ { T } \mathbf x + b _ { t } - b _ { s } ) } \\ & { \phantom { 2 } - \cos ( 2 \pi ( \mathbf w _ { t } + \mathbf w _ { s } ) ^ { T } \mathbf x + b _ { t } + b _ { s } ) \biggr ] \mathrm { d } \mathbf x } \\ { = } & { 0 . 5 \exp ( j ( b _ { t } - b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } - \mathbf w _ { s } ) } \\ { + 0 . 5 \exp ( j ( b _ { t } - b _ { t } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { j } - \mathbf w _ { t } ) } \\ & { \phantom { 2 } - 0 . 5 \exp ( j ( b _ { t } + b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } + \mathbf w _ { s } ) } \\ { - 0 . 5 \exp ( j ( b _ { t } + b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } + \mathbf w _ { s } ) } \\ & { \phantom { 2 } - 0 . 5 \exp ( j ( b _ { t } + b _ { t } ) ) \widehat { P } \widetilde { \mathbf x } ( - \mathbf w _ { t } - \mathbf w _ { j } ) } \\ { = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t < j _ { s } } \\ { 1 } & { \mathrm { i f ~ } t = j _ { s } } \end{array} \right. } \end{array}$$
Also, by applying the convolution property of Fourier transform we can show
$$\begin{array} { r l } { \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) Y ( \mathbf { X } ) \right] = \displaystyle \int P _ { \mathbf { X } } ( \mathbf { x } ) Y ( \mathbf { x } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) \mathrm { d } \mathbf { x } } & { } \\ { = \displaystyle \int ( P _ { \mathbf { X } } \times Y ) ( \mathbf { x } ) \left[ \cos ( b _ { j } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } ) + \sin ( b _ { j } ) \cos ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } ) \right] \mathrm { d } \mathbf { x } } & { } \\ { = \cos ( b _ { j } ) \mathrm { I m } \{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \} + \sin ( b _ { j } ) \mathrm { R e } \{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \} . } & { } \end{array}$$
Finally if $( \mathbf { a } , \mathbf { W } , \mathbf { b } )$ is a local minimum for the population risk, for all $t$ ’s we have $\nabla _ { a _ { t } } \bar { \mathbb { E } } _ { P _ { \mathbf { X } } } \big [ \ell \big ( \dot { f } _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \big ] \ = \ 0$ . Therefore, due to the isolatedness assumption of $\mathbf { w } _ { j }$ we have
$$| a _ { j } | = 2 \left| \cos ( b _ { j } ) \operatorname { I m } \bigl \{ \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr \} + \sin ( b _ { j } ) \operatorname { R e } \bigl \{ \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr \} \right| \leq 2 \bigl | \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr | .$$
# 8.5 PROOF OF THEOREM 4
Since the isolatedness assumption holds for all $j$ ’s, by Lemma 1,
$$\forall j : \quad | a _ { j } ^ { * } | \leq 2 \bigl | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ^ { * } ) \bigr | .$$
If $\| \mathbf { w } _ { t } ^ { * } \| _ { 2 } > B ( Y ) + B ( P _ { \mathbf { X } } )$ holds for some $t$ , (37) implies
$$| a _ { t } ^ { * } | \leq 2 \bigl | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } ) \bigr | = 0 .$$
Hence, $a _ { t } ^ { * }$ will be 0, implying there will be no component in $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ with $\| \mathbf { w } _ { t } ^ { * } \| _ { 2 } > B ( Y ) + B ( P _ { \mathbf { X } } )$ . This discussion proves the first part of Theorem, i.e. $B ( f _ { \mathbf { a } ^ { * } } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } ) \leq B ( Y ) + B ( P _ { \mathbf { X } } )$ .
To show the second part, note that
$$\begin{array} { r l } { \| A _ { \varepsilon } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 2 } } & { = | \alpha | ^ { 3 } \| _ { \infty } ^ { 3 } } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } \mathrm { d } u \varepsilon } \\ & { = 2 \displaystyle \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } \mathrm { d } u \varepsilon } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 4 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } | \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & - 2 \displaystyle \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ \ \end{array}$$
Here, (a) comes from Lemma 1. Also, since $\operatorname* { m i n } \Bigl \{ \| \mathbf { w } _ { t } ^ { * } - \mathbf { w } _ { r } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { t } ^ { * } + \mathbf { w } _ { r } ^ { * } \| _ { 2 } \Bigr \} > 2 B ( P _ { \mathbf { X } } )$ is assumed for any $t \neq r$ , for any $\boldsymbol { \xi }$ at most one element in $\left[ \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } ) \right] _ { t = 1 } ^ { d }$ can be nonzero. Because if both $\widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } )$ and $\widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { r } ^ { * } - \pmb { \xi } )$ are nonzero for $r \neq t$ , then $\| \mathbf { w } _ { t } ^ { * } - \pmb { \xi } \| \leq B ( P _ { \mathbf { X } } )$ and also $\| \mathbf { w } _ { r } ^ { * } - \pmb { \xi } \| \leq B ( P _ { \mathbf { X } } )$ which results in $\| \mathbf { w } _ { t } ^ { * } - \mathbf { w } _ { r } ^ { * } \| \leq 2 B ( P _ { \mathbf { X } } )$ which is a contradiction. Hence,
$$\sum _ { t = 1 } ^ { d } \left| \widehat { P } \mathbf { x } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } ) \right| \leq \operatorname* { m a x } _ { \pmb { \xi } ^ { \prime } } \left| \widehat { P } \mathbf { x } ( \pmb { \xi } ^ { \prime } ) \right| \leq \int \left| P \mathbf { x } ( \mathbf { x } ) \right| \mathrm { d } \mathbf { x } = 1 ,$$
which proves (b) and completes the proof.
# 8.5.1 APPLYING THEOREM 4 TO MULTIVARIATE GAUSSIAN X
Assume $\mathbf { X } \sim { \mathcal { N } } ( \mu , \sigma ^ { 2 } \mathbf { I } _ { k \times k } )$ has a multivariate Gaussian distribution with mean $\pmb { \mu }$ and standard deviation $\sigma$ . Then, the Fourier transform $\hat { P } _ { \mathbf { X } }$ has a Gaussian shape with mean 0 and standard deviation $1 / \sigma$ . Hence, if for any $i , j$ we have $\operatorname* { m i n } \bigr \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} \stackrel { } { > } 2 C / \sigma$ for some constant $C$ , the approximation error term which should be added to the upperbound in Equation (39) is $2 \| \widehat { Y } \| _ { 1 } d \exp ( - C ^ { 2 } / 2 )$ . Also, given any $\epsilon > 0$ the Fourier $\ell _ { 1 }$ norm outside the bandwidth $O ( \sqrt { k } \log ( 1 / \epsilon ) / \sigma )$ is at most $\epsilon$ . Therefore, Theorem 4 implies
$$\begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + O \big ( \sqrt { k } / \sigma \big ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 ( 1 + d \exp ( - C ^ { 2 } / 2 ) ) \| \widehat { Y } \| _ { 1 } . } \end{array}$$
# 8.6 APPROXIMATE VERSION OF THEOREM 4
Here we show an approximate version of Theorem 4 which applies to approximate population local minima.
Theorem 5. Consider minimizing the population risk (11). Consider an approximate local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } )$ where $| \nabla _ { a _ { j } } \mathbb { E } \big [ \ell \big ( f _ { { \mathbf a } ^ { * } , { \mathbf W } ^ { * } , { \mathbf b } ^ { * } } ( { \mathbf { \dot { X } } } ) , Y ( { \mathbf { X } } ) \big ) \big ) \big ] | \ \leq \ \epsilon$ for all $j$ ’s. If for any two different $i , j$ we
have $\operatorname* { m i n } \bigl \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 B ( P _ { \mathbf { X } } )$ , then the Fourier $\ell _ { 1 }$ -norm of $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ outside the bandwidth $\mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } )$ is bounded by $d \epsilon$ and
$$\begin{array} { r } { \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } + d \epsilon . } \end{array}$$
Proof. Since the isolated components condition holds, we can apply Lemma 1’s proof to show under the above assumptions
$$\forall j : \quad | a _ { j } ^ { * } | \leq 2 \big | \hat { Y } \star \hat { P } _ { \mathbf { X } } ( \mathbf { w } _ { j } ^ { * } ) \big | + \epsilon .$$
Then, a simple modification of Theorem 4’s proof according to the above inequality proves the above theorem. □
# 8.7 PROOF OF THEOREM 4 WITHOUT THE ISOLATED COMPONENTS ASSUMPTION
What happens if a component $\mathbf { w } _ { i }$ is not isolated from the other components which has been assumed in Theorem 4? As a simplifying assumption, we assume that $\mathbf b = \mathbf 0$ and $\widehat { P _ { \mathbf { X } } }$ is real. We can write
$$\begin{array} { r l } { \displaystyle \forall i : \nabla _ { a _ { i } } \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \ell \Big ( f _ { \mathbf { a } , \mathbf { w } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \Big ) \right] = \sum _ { j = 1 } ^ { d } \left[ a _ { j } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] - \operatorname { I m } \left\{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } ) \right\} } & { } \\ { \displaystyle } & { \approx \sum _ { j = 1 } ^ { d } \left[ \left( a _ { j } - \int _ { \xi \in S _ { \mathbf { w } _ { j } } } \operatorname { I m } \{ \widehat { Y } ( \xi ) \} { \mathrm { d } } \xi \right) \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] } \end{array}$$
Here $S _ { \mathbf { w } _ { i } }$ ’s, which are centered around $\mathbf { w } _ { j }$ ’s, are disjoint sets covering the bandwidth region for $\widehat { Y }$ , i.e. $\{ \pmb { \xi } : \| \pmb { \xi } \| _ { 2 } ^ { \prime } \leq B ( Y ) \} \subseteq \bigcup _ { j } S _ { \mathbf { w } _ { j } }$ . Note that in (41) we have approximated the convolution integral as
$$\begin{array} { r l } { \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } ) = \displaystyle \int _ { \pm : \| \xi \| _ { 2 } \leq B ( Y ) } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \pmb { \xi } ) \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi } & { } \\ { = \displaystyle \sum _ { j = 1 } ^ { d } \displaystyle \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \pmb { \xi } ) \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi } & { } \\ { \approx \displaystyle \sum _ { j = 1 } ^ { d } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \displaystyle \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi . } \end{array}$$
Letting the gradient element in (41) be zero for all $a _ { i }$ ’s at a local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } )$ of the population risk, the following approximation holds in general case:
$$\forall j : a _ { j } ^ { * } \approx \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \mathrm { I m } \{ \widehat { Y } ( \pmb { \xi } ) \} \mathrm { d } \pmb { \xi } ,$$
Here, the matrix $\left[ \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] _ { 1 \leq i , j \leq d }$ is positive-definite and hence invertible, because $\widehat { P \mathbf { x } }$ is the Fourier transform of $P \mathbf { x }$ and due to Bochner’s theorem a positive-definite kernel function. Therefore, the system of linear equations -PcX(w∗i − w∗j ) -a∗j − Rξ∈Sw $\begin{array} { r } { \left[ \widehat { P _ { { \bf X } } } ( { \bf w } _ { i } ^ { * } - { \bf w } _ { j } ^ { * } ) \right] \left[ a _ { j } ^ { * } - \int _ { \pmb { \xi } \in S _ { { \bf w } _ { j } } } \mathrm { I m } \{ \widehat { Y } ( \pmb { \xi } ) \} \mathrm { d } \pmb { \xi } \right] \approx \mathbf { 0 } } \end{array}$ would imply (42). This discussion indicates that the result of Theorem 4 would remain valid even if the isolated components condition does not hold.md/dev/MSBDFwGYwwt/MSBDFwGYwwt.mdAdded+297
md/dev/ZlCpRiZN7n/ZlCpRiZN7n.mdAdded+315
md/dev/nrksGSRT7kX/nrksGSRT7kX.mdAdded+362
md/train/0lz69oI5iZP/0lz69oI5iZP.mdAdded+241
md/train/B1IzH7cxl/B1IzH7cxl.mdAdded+401
md/train/BJE-4xW0W/BJE-4xW0W.mdAdded
md/train/BJbD_Pqlg/BJbD_Pqlg.mdAdded+398
md/train/BJgcwh4FwS/BJgcwh4FwS.mdAdded+467
md/train/BJl_VnR9Km/BJl_VnR9Km.mdAdded+320
md/train/ByG8A7cee/ByG8A7cee.mdAdded+331
md/train/CoJibBRjPXQ/CoJibBRjPXQ.mdAdded+509
md/train/FsLTUzZlsgT/FsLTUzZlsgT.mdAdded+360
md/train/H1e_cC4twS/H1e_cC4twS.mdAdded+358
md/train/H1eqOnNYDH/H1eqOnNYDH.mdAdded+396
md/train/H1xk8jAqKQ/H1xk8jAqKQ.mdAdded+398
md/train/HJBhEMbRb/HJBhEMbRb.mdAdded+557
md/train/HJWHIKqgl/HJWHIKqgl.mdAdded
md/train/HJem3yHKwH/HJem3yHKwH.mdAdded
md/train/HJx8HANFDH/HJx8HANFDH.mdAdded
md/train/Hkg5lAEtvS/Hkg5lAEtvS.mdAdded
md/train/HkpYwMZRb/HkpYwMZRb.mdAdded
md/train/OU98jZWS3x_/OU98jZWS3x_.mdAdded
md/train/S1c2cvqee/S1c2cvqee.mdAdded
md/train/S1lvm305YQ/S1lvm305YQ.mdAdded
md/train/S1vuO-bCW/S1vuO-bCW.mdAdded
md/train/SJeeL04KvH/SJeeL04KvH.mdAdded
md/train/SJlhPMWAW/SJlhPMWAW.mdAdded
md/train/SJxstlHFPH/SJxstlHFPH.mdAdded
md/train/Sk-oDY9ge/Sk-oDY9ge.mdAdded
md/train/SkEqro0ctQ/SkEqro0ctQ.mdAdded
md/train/SkVhlh09tX/SkVhlh09tX.mdAdded
md/train/Skgb5h4KPH/Skgb5h4KPH.mdAdded
md/train/Skn9Shcxe/Skn9Shcxe.mdAdded
md/train/SyxnvsAqFm/SyxnvsAqFm.mdAdded
md/train/TR-Nj6nFx42/TR-Nj6nFx42.mdAdded
md/train/YUEFlzlG_0c/YUEFlzlG_0c.mdAdded
md/train/fIn4wLS2XzU/fIn4wLS2XzU.mdAdded
md/train/hm0i-cunzGW/hm0i-cunzGW.mdAdded
md/train/i_Q1yrOegLY/i_Q1yrOegLY.mdAdded
md/train/iklDP-v1sgi/iklDP-v1sgi.mdAdded
md/train/lM2971LAwV/lM2971LAwV.mdAdded
md/train/q8qLAbQBupm/q8qLAbQBupm.mdAdded
md/train/r1lZgyBYwS/r1lZgyBYwS.mdAdded
md/train/rJe4_xSFDB/rJe4_xSFDB.mdAdded
md/train/rJqFGTslg/rJqFGTslg.mdAdded
md/train/rJxt0JHKvS/rJxt0JHKvS.mdAdded
md/train/rkEFLFqee/rkEFLFqee.mdAdded
md/train/ryloogSKDS/ryloogSKDS.mdAdded
md/train/yvQKLaqNE6M/yvQKLaqNE6M.mdAdded
md/train/zv-typ1gPxA/zv-typ1gPxA.mdAdded