paper_name
stringlengths
11
170
text
stringlengths
8.07k
307k
summary
stringlengths
152
6.16k
paper_id
stringlengths
43
43
The Risks of Invariant Risk Minimization
1 INTRODUCTION . Prediction algorithms are evaluated by their performance on unseen test data . In classical machine learning , it is common to assume that such data are drawn i.i.d . from the same distribution as the data set on which the learning algorithm was trained—in the real world , however , this is often not the case . When this discrepancy occurs , algorithms with strong in-distribution generalization guarantees , such as Empirical Risk Minimization ( ERM ) , can fail catastrophically . In particular , while deep neural networks achieve superhuman performance on many tasks , there is evidence that they rely on statistically informative but non-causal features in the data ( Beery et al. , 2018 ; Geirhos et al. , 2018 ; Ilyas et al. , 2019 ) . As a result , such models are prone to errors under surprisingly minor distribution shift ( Su et al. , 2019 ; Recht et al. , 2019 ) . To address this , researchers have investigated alternative objectives for training predictors which are robust to possibly egregious shifts in the test distribution . The task of generalizing under such shifts , known as Out-of-Distribution ( OOD ) Generalization , has led to many separate threads of research . One approach is Bayesian deep learning , accounting for a classifier ’ s uncertainty at test time ( Neal , 2012 ) . Another technique that has shown promise is data augmentation—this includes both automated data modifications which help prevent overfitting ( Shorten & Khoshgoftaar , 2019 ) and specific counterfactual augmentations to ensure invariance in the resulting features ( Volpi et al. , 2018 ; Kaushik et al. , 2020 ) . A strategy which has recently gained particular traction is Invariant Causal Prediction ( ICP ; Peters et al . 2016 ) , which views the task of OOD generalization through the lens of causality . This framework assumes that the data are generated according to a Structural Equation Model ( SEM ; Bollen 2005 ) , which consists of a set of so-called mechanisms or structural equations that specify variables given their parents . ICP assumes moreover that the data can be partitioned into environments , where each environment corresponds to interventions on the SEM ( Pearl , 2009 ) , but where the mechanism by which the target variable is generated via its direct parents is unaffected . Thus the causal mechanism of the target variable is unchanging but other aspects of the distribution can vary broadly . As a result , learning mechanisms that are the same across environments ensures recovery of the invariant features which generalize under arbitrary interventions . In this work , we consider objectives that attempt to learn what we refer to as the “ optimal invariant predictor ” —this is the classifier which uses and is optimal with respect to only the invariant features in the SEM . By definition , such a classifier does not overfit to environment-specific properties of the data distribution , so it will generalize even under major distribution shift at test time . In particular , we focus our analysis on one of the more popular objectives , Invariant Risk Minimization ( IRM ; Arjovsky et al . ( 2019 ) ) , but our results can easily be extended to similar recently proposed alternatives . Various works on invariant prediction ( Muandet et al. , 2013 ; Ghassami et al. , 2017 ; Heinze-Deml et al. , 2018 ; Rojas-Carulla et al. , 2018 ; Subbaswamy et al. , 2019 ; Christiansen et al. , 2020 ) consider regression in both the linear and non-linear setting , but they exclusively focus on learning with fully or partially observed covariates or some other source of information . Under such a condition , results from causal inference ( Maathuis et al. , 2009 ; Peters et al. , 2017 ) allow for formal guarantees of the identification of the invariant features , or at least a strict subset of them . With the rise of deep learning , more recent literature has developed objectives for learning invariant representations when the data are a non-linear function of unobserved latent factors , a common assumption when working with complex , high-dimensional data such as images . Causal discovery and inference with unobserved confounders or latents is a much harder problem ( Peters et al. , 2017 ) , so while empirical results seem encouraging , these objectives are presented with few formal guarantees . IRM is one such objective for invariant representation learning . The goal of IRM is to learn a feature embedder such that the optimal linear predictor on top of these features is the same for every environment—the idea being that only the invariant features will have an optimal predictor that is invariant . Recent works have pointed to shortcomings of IRM and have suggested modifications which they claim prevent these failures . However , these alternatives are compared in broad strokes , with little in the way of theory . In this work , we present the first formal analysis of classification under the IRM objective under a fairly natural and general model which carefully formalizes the intuition behind the original work . Our results show that despite being inspired by invariant prediction , this objective can frequently be expected to perform no better than ERM . In the linear setting , we present simple , exact conditions under which solving to optimality succeeds or , more often , breaks down in recovering the optimal invariant predictor . We also demonstrate another major failure case—under mild conditions , there exists a feasible point that uses only non-invariant features and achieves lower empirical risk than the optimal invariant predictor ; thus it will appear as a more attractive solution , yet its reliance on non-invariant features mean it will fail to generalize . As corollaries , we present similar settings where all recently suggested alternatives to IRM likewise fail . Futhermore , we present the first results in the non-linear regime : we demonstrate the existence of a classifier with exponentially small suboptimality which nevertheless heavily relies on non-invariant features on most test inputs , resulting in worse-than-chance performance on distributions that are sufficiently dissimilar from the training environments . These findings strongly suggest that existing approaches to ICP for high-dimensional latent variable models do not cleanly achieve their stated objective and that future work would benefit from a more formal treatment . 2 RELATED WORK . Works on learning deep invariant representations vary considerably : some search for a domaininvariant representation ( Muandet et al. , 2013 ; Ganin et al. , 2016 ) , i.e . invariance of the distribution p ( Φ ( x ) ) , typically used for domain adaptation ( Ben-David et al. , 2010 ; Ganin & Lempitsky , 2015 ; Zhang et al. , 2015 ; Long et al. , 2018 ) , with assumed access to labeled or unlabeled data from the target distribution . Other works instead hope to find representations that are conditionally domain-invariant , with invariance of p ( Φ ( x ) | y ) ( Gong et al. , 2016 ; Li et al. , 2018 ) . However , there is evidence that invariance may not be sufficient for domain adaptation ( Zhao et al. , 2019 ; Johansson et al. , 2019 ) . In contrast , this paper focuses instead on domain generalization ( Blanchard et al. , 2011 ; Rosenfeld et al. , 2021 ) , where access to the test distribution is not assumed . Recent works on domain generalization , including the objectives discussed in this paper , suggest invariance of the feature-conditioned label distribution . In particular , Arjovsky et al . ( 2019 ) only assume invariance of E [ y | Φ ( x ) ] ; follow-up works rely on a stronger assumption of invariance of higher conditional moments ( Krueger et al. , 2020 ; Xie et al. , 2020 ; Jin et al. , 2020 ; Mahajan et al. , 2020 ; Bellot & van der Schaar , 2020 ) . Though this approach has become popular in the last year , it is somewhat similar to the existing concept of covariate shift ( Shimodaira , 2000 ; Bickel et al. , 2009 ) , which considers the same setting . The main difference is that these more recent works assume that the shifts in p ( Φ ( x ) ) occur between discrete , labeled environments , as opposed to more generally from train to test distributions . Some concurrent lines of work study different settings yet give results which are remarkably similar to ours . Xu et al . ( 2021 ) show that an infinitely wide two-layer network extrapolates linear functions when the training data is sufficiently diverse . In the context of domain generalization specifically , Rosenfeld et al . ( 2021 ) prove that ERM remains optimal for both interpolation and extrapolation in the linear setting and that the latter is exponentially harder than the former . These results mirror our findings that none of the studied objectives outperform ERM . 3 MODEL AND INFORMAL RESULTS . We consider an SEM with explicit separation of invariant features zc , whose joint distribution with the label is fixed for all environments , and environmental features ze ( “ non-invariant ” ) , whose distribution can vary . This choice is to ensure that our model properly formalizes the intuition behind invariant prediction techniques such as IRM , whose objective is to ensure generalizing predictors by recovering only the invariant features—we put off a detailed description of these objectives until after we have introduced the necessary terminology . We assume that data are drawn from a set of E training environments E = { e1 , e2 , . . . , eE } and that we know from which environment each sample is drawn . For a given environment e , the data are defined by the following process : first , a label y ∈ { ±1 } is drawn according to a fixed probability : y = { 1 , w.p . η −1 , otherwise . ( 1 ) Next , both invariant features and environmental features are drawn according to a Gaussian:1 zc ∼ N ( y · µc , σ2cI ) , ze ∼ N ( y · µe , σ2eI ) , ( 2 ) with µc ∈ Rdc , µe ∈ Rde—typically , for complex , high-dimensional data we would expect E < dc de . Finally , the observation x is generated as a function of the latent features : x = f ( zc , ze ) . ( 3 ) The complete data generating process is displayed in Figure 3.1 . We assume f is injective , so that it is in principle possible to recover the latent features from the observations , i.e . there exists a function Φ such that Φ ( f ( zc , ze ) ) = [ zc , ze ] T . We remark that this our only assumption on f , even when it is non-linear . Further , note that we model class-conditional means as direct opposites merely for clarity , as it greatly simplifies the calculations . None of our proofs require this condition : it is straightforward to extend our results to arbitrary means , and the non-linear setting also allows for arbitrary covariances . In fact , our proof technique for non-linear f could be applied to any distribution that sufficiently concentrates about its mean ( e.g. , sub-Gaussian ) . We write the joint and marginal distributions as pe ( x , y , zc , ze ) . When clear from context , we omit the specific arguments . Remarks on the model . This model is natural and flexible ; it generalizes several existing models used to analyze learning under the existence of adversarial distribution shift or non-invariant correlations ( Schmidt et al. , 2018 ; Sagawa et al. , 2020 ) . The fundamental facet of this model is the constancy of the invariant parameters η , µc , σ2c , f across environments—the dependence of µe , σe on the environment allows for varying distributions , while the true causal process remains unchanged . Here we make a few clarifying remarks : • We do not impose any constraints on the model parameters . In particular , we do not assume a prior over the environmental parameters . Observe that µc , σ2c are the same for all environments , 1Note the deliberate choice to have ze depend on y . Much work on this problem models spurious features which correlate with the label but are not causal . However , the term “ spurious ” is often applied incongruously ; in recent work , the term has been co-opted to refer to any feature that correlates with the label but does not cause it . Thus there is a subtle distinction : if we allow for anti-causality , i.e . the label causing the features , the resulting correlation is not spurious . We therefore avoid using the term “ spurious ” in this work . hence the subscript indicates the invariant relationship . In contrast , with some abuse of notation , the environmental subscript is used to indicate both dependence on the environment and the index of the environment itself ( e.g. , µi represents the mean specific to environment i ) . • While we have framed the model as y causing zc , the causation can just as easily be viewed in the other direction . The log-odds of y are a linear function of zc—this matches logistic regression with an invariant regression vector βc = 2µc/σ2c and bias β0 = log η 1−η . We present the model as above to emphasize that the causal relationships between y and the zc , ze are a priori indistinguishable , and because we believe this direction is more intuitive . We consider the setting where we are given infinite samples from each environment ; this allows us to isolate the behavior of the objectives themselves , rather than finite-sample effects . Upon observing samples from this model , our objective is thus to learn a feature embedder Φ and classifier2 β̂ to minimize the risk on an unseen environment e : Re ( Φ , β̂ ) : = E ( x , y ) ∼pe [ ` ( σ ( β̂TΦ ( x ) ) , y ) ] . The function ` can be any loss appropriate to classification : in this work we consider the logistic and the 0-1 loss . Note that we are not hoping to minimize risk in expectation over the environments ; this is already accomplished via ERM or distributionally robust optimization ( DRO ; Bagnell 2005 ; Ben-Tal et al . 2009 ) . Rather , we hope to extract and regress on invariant features while ignoring environmental features , such that our predictor generalizes to all unseen environments regardless of their parameters . In other words , the focus is on minimizing risk in the worst-case . We refer to the predictor which will minimize worst-case risk under arbitrary distribution shift as the optimal invariant predictor . To discuss this formally , we define precisely what we mean by this term . Definition 1 . Under the model described by Equations 1-3 , the optimal invariant predictor is the predictor defined by the composition of a ) the featurizer which recovers the invariant features and b ) the classifier which is optimal with respect to those features : Φ∗ ( x ) : = [ I 0 0 0 ] ◦ f−1 ( x ) = [ zc ] , β̂∗ : = [ βc β0 ] : = [ 2µc/σ 2 c log η1−η ] . Observe that this definition closely resembles Definition 3 of Arjovsky et al . ( 2019 ) ; the only difference is that here the optimal invariant predictor must recover all invariant features . As Arjovsky et al . ( 2019 ) do not posit a data model , the concept of recovering “ all invariant features ” is not welldefined for their setting ; technically , a featurizer which outputs the empty set would elicit an invariant predictor , but this would not satisfy the above definition . The classifier β̂∗ is optimal with respect to the invariant features and so it achieves the minimum possible risk without using environmental features . Observe that the optimal invariant predictor is distinct from the Bayes classifier ; the Bayes classifier uses environmental features which are informative of the label but non-invariant ; the optimal invariant predictor explicitly ignores these features . With the model defined , we can informally present our results ; we defer the formal statements to first give a background on the IRM objective in the next section . With a slight abuse of notation , we identify a predictor by the tuple Φ , β̂ which parametrizes it . First , we show that the usefulness of IRM exhibits a “ thresholding ” behavior depending on E and de : Theorem 3.1 ( Informal , Linear ) . For linear f , consider solving the IRM objective to learn a linear Φ with invariant optimal classifier β̂ . If E > de , then Φ , β̂ is precisely the optimal invariant predictor ; it uses only invariant features and generalizes to all environments with minimax-optimal risk . If E ≤ de , then Φ , β̂ relies upon non-invariant features . In fact , when E ≤ de it is even possible to learn a classifier solely relying on environmental features that achieves lower risk on the training environments than the optimal invariant predictor : 2Following the terminology of Arjovsky et al . ( 2019 ) , we refer to the regression vector β̂ as a “ classifier ” and the composition of Φ , β̂ as a “ predictor ” . Theorem 3.2 ( Informal , Linear ) . For linear f and E ≤ de there exists a linear predictor Φ , β̂ which uses only environmental features , yet achieves lower risk than the optimal invariant predictor . Finally , in the non-linear case , we show that IRM fails unless the training environments approximately “ cover ” the space of possible environments , and therefore it behaves similarly to ERM : Theorem 3.3 ( Informal , Non-linear ) . For arbitrary f , there exists a non-linear predictor Φ , β̂ which is nearly optimal under the penalized objective and furthermore is nearly identical to the optimal invariant predictor on the training distribution . However , for any test environment with a mean sufficiently different from the training means , this predictor will be equivalent to the ERM solution on nearly all test points . For test distributions where the environmental feature correlations with the label are reversed , this predictor has almost 0 accuracy . Extensions to other objectives . Many follow-up works have suggested alternatives to IRM—some are described in the next section . Though these objectives perform better on various baselines , there are few formal guarantees and no results beyond the linear case . Due to their collective similarities , we can easily derive corollaries which extend every theorem in this paper to these objectives , demonstrating that they all suffer from the same shortcomings . Appendix E contains example corollaries for each of the results presented in this work .
This paper studies a theoretical aspect of IRM and how will it fail. Main contribution is pointing out that IRM is ineffective when the number of environments $E$ is smaller than the dimension of environmental feature $d_e$. A simple but universal model assumption is built, where environmental feature $z_e$ and causal feature $z_c$ is sampled from Gaussian conditional on label $y$. The analysis is two-fold: linear regime and non-linear regime. In the former part, given the feature extractor $\Phi$ is linear, a constructed solution to IRM is built to demonstrate the result. For the latter part, the other show the failure of IRM via several results in Thm 6.1 / D.3. The whole analysis is clear and easy to follow, thus the reviewer believe this submission deserves to be accepted.
SP:c4d8b135b7625ac0b52bdc4b9753c0db61b4d777
Differentiable Optimization of Generalized Nondecomposable Functions using Linear Programs
1 Introduction . Commonly used losses such as cross-entropy used in deep neural network ( DNN ) models can be expressed as a sum over the per-sample losses incurred by the current estimate of the model . This allows the direct use of mature optimization routines , and is sufficient for many use cases . But in applications ranging from ranking/retrieval to class imbalanced learning , the most suitable losses for the task do not admit a “ decompose over samples ” form . Examples include Area under the ROC curve ( AUC ) , multi-class variants of AUC , F -score , Precision at a fixed recall ( P @ R ) and others . Optimizing such measures in a scalable manner can pose challenges even in the shallow setting . For AUC maximization , we now know that convex surrogate losses can be used in a linear model Liu et al . [ 2018 ] , Natole et al . [ 2018 ] in the so-called ERM framework . These ideas have been incorporated within deep neural network models and solved using SGD type schemes in Liu et al . [ 2019 ] . Such results on stochastic and online data models have also been explored in Ataman et al . [ 2006 ] , Cortes and Mohri [ 2004 ] , Gao et al . [ 2013 ] . There are also available strategies for measures other 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) , virtual . than the AUC : Nan et al . [ 2012 ] , Dembczynski et al . [ 2011 ] give exact algorithms for optimizing F -score and Eban et al . [ 2017 ] , Ravi et al . [ 2020 ] proposes scalable methods for non-decomposable objectives which utilizes Lagrange multipliers to construct the proxy objectives . The authors in Mohapatra et al . [ 2018 ] discuss using a function that upper bounds ( structured ) hinge-loss to optimize average precision . Recently , Fathony and Kolter [ 2020 ] presented an adversarial prediction formulation for such nondecomposable measures , and showed that it is indeed possible to incorporate such measures within differentiable pipelines . Our work utilizes the simple observation that a number of these non-decomposable objectives can be expressed in the form of an integer program that can be relaxed to a linear program ( LP ) . Our approach is based on the premise that tackling the LP form of the non-decomposable objective as a module within the DNN , one which permits forward and reverse mode differentiation and can utilize in-built support for specialized GPU hardware in modern libraries such as PyTorch , is desirable . First , as long as a suitable LP formulation for an objective is available , the module may be directly used . Second , based on which scheme is used to solve the LP , one may be able to provide guarantees for the non-decomposable objective based on simple calculations ( e.g. , number of constraints , primal-dual gap ) . The current tools do not entirely address all these requirements . A characteristic of the LPs that arise from the nondecomposable losses mentioned above is that the constraints ( including the mini-batch of samples themselves ) are modified at each iteration – as a function of the updates to the representations of the data in the upstream layers . In Section 3 , we provide LP formulations of widely used nondecomposable terms , which fall squarely within the capabilities of our solver . In Section 4 , we show that the modified Newton ’ s algorithm in Mangasarian [ 2004 ] can be used for deep neural network ( DNN ) training in an end-to-end manner without requiring external solvers , where support for GPUs currently remains limited . Specifically , by exploiting self-concordance of the objective , we show that the algorithm can converge globally without line search . We then analyze the gradient properties of our approach , and some modifications to improve stability during backpropagation . Our experiments in Section 5 show that this scheme based on Mangasarian ’ s parametric exterior penalty formulation of the primal LP is a computationally effective and scalable strategy to solve LPs with a large number of constraints . On the practical side , we provide two ways to deal with the scaling issue when the constraint matrix is large . On the one hand , we show that sufficient dimension reduction can be used in our solver to solve the problem in a lower dimension space . On the other hand , when the matrix is sparse , with our new sparse implementation , we show that we can train Resnet-18 with 10× mini-batch size ( memory savings ) on a 2080TI Nvidia GPU . Our code is available , see Fig 1 for an overview of our solver for differentiating many popular nondecomposable objectives . 2 Related Works . Differentiable optimization of nondecomposable objectives . One closely related result to ours is Liu et al . [ 2019 ] which explored optimizing a surrogate loss of AUC using SGD type methods that made the stochastic AUC optimization more practical for deep neural networks . Compared with Liu et al . [ 2019 ] , our work enables optimizing many more types of nondecomposable objectives for deep neural networks , and relies on the LP reformulation instead of a surrogate loss . In Fathony and Kolter [ 2020 ] , ( the expected values of ) such metrics are approximated by LPs defined by predictor and adversary marginal distributions ( represented as square matrices ) . The ADMM solver in Fathony and Kolter [ 2020 ] , as we will see , inherits some drawbacks of ADMMs including higher memory footprint and slower convergence . Another body of work is the one involving the use of blackbox solvers Pogančić et al . [ 2019 ] , Berthet et al . [ 2020 ] which can be adapted to solve the nondecomposable objectives ( e.g. , reformulating as LPs ) . For example , one idea is to use appropriate ( infimal or gaussian ) convolution to construct approximations of the gradients through the LP . Song et al . [ 2016 ] proposes a using a task loss to perturb the loss and is similar in spirit to blackbox solvers – they both solve a sequence of perturbed argmax/argmin problems first , and then use carefully designed procedures for the backward gradient that often require at least one more solve of the optimization problem . We will discuss these properties later in the paper , and in our experiments . Differentiable LP solver . In principle , of course , backpropagating through a convex optimization model ( and in particular , LPs ) is quite possible . For LPs , we can take derivatives of the optimal value ( or the optimal solution ) of the model with respect to the LP parameters , and this can be accomplished by calling a powerful external solver . Often , this would involve the overhead of running the solver on the CPU . Solvers within CVXPY , are effective but due to their general-purpose nature , rely on interior point methods . OptNet Amos and Kolter [ 2017 ] is quite efficient but designed for quadratic programs ( QP ) : the theoretical results and its efficiency depends on factorizing a matrix in the quadratic term in the objective ( which is zero/non-invertible for LPs ) . The primal-dual properties and implicit differentiation for QPs do not easily translate to LPs due to the polyhedral geometry in LPs . The ideas in Meng et al . [ 2020 ] are only applicable when the number of constraints is approximately equal to the number of variables – an invalid assumption for the models that we study here . 3 Nondecomposable Functions and corresponding LP models . We first present a standard LP form and then reparameterize several generalized nondecomposable objectives in this way , summarized in a table in the appendix . We start with the binary AUC , extend it to multi-class AUC , and then later , discuss a ratio objective , F -score . The appendix also includes a discussion of other objectives that are amenable to our method . 3.1 Notations and Generalized LP formulation . Notations . We use the following notations : ( i ) n : number of samples used in training . ( ii ) X ∈ Rn×dimx : the explanatory features fed to a classifier ( e.g. , parameterized by w ) ; ( iii ) f ( xi ) ( or f ( i ) ) : a score function for the classifier where xi ∈ X ; ( iv ) Y ∈ { 0 , 1 } : target label and Ŷ ∈ { 0 , 1 } : predicted label for binary classification , both in Rn ; ( v ) A⊗B : Kronecker product of matrices A and B . ( vi ) Ir : Identity matrix of size r and 1 is the indicator function . ( vii ) Bk , p ( and B| , k′ ) gives the k-th row ( and k′-th ) column of B. LP formulation . We consider a general linear program ( LP ) that contains nonnegative variables as well as inequality and equality constraints . The form of the LP is given as max ũ , ṽ gT ũ+ hT ṽ subject to Eũ+ F ṽ ≤ p , Bũ+Gṽ = q ũ , ṽ ≥ 0 We can write it more succinctly as Variable z = [ ũ ṽ ] ; Coefficient c = [ −g − h ] ; Constraints A = [ E B −B F G −G ] T ; Constants b = [ p q − q ] T The corresponding primal LP can be written as , minz cT z subject to Az ≤ b , z ≥ 0 . 3.2 Maximizing AUC . The Area under the ROC Curve ( AUC ) calculates the probability that a classifier f ( · ) will rank a randomly chosen positive sample higher than a randomly chosen negative sample . AUC varies between 0 and 1 , where 1 represents all positives being ranked above the negatives . AUC may be estimated using the Wilcoxon-Mann-Whitney ( WMW ) Statistic Hanley and McNeil [ 1982 ] , as Definition 3.1 ( AUC ) . Let n be the number of samples . Let X+ ( and X− resp . ) be the set of positive ( and negative resp . ) samples such that |X+|+ |X−| = n where | · | is the cardinality of the set . Then , AUC is given as ( ∑|X+| i=1 ∑|X−| i=1 1f ( xi ) > f ( xj ) ) / ( |X+| |X−| ) for xi : i ∈ { 1 , · · · , n } . Here , we follow Ataman et al . [ 2006 ] to calculate the AUC based on the WMW statistic as follows . min zij |X+|∑ i=1 |X−|∑ j=1 zij s.t . f ( xi ) − f ( xj ) ≥ ϵ− zij where xi ∈ X+ , xj ∈ X− ; zij ≥ 0 , ( 1 ) where ϵ is a given constant . Problem ( 1 ) computes AUC indirectly by minimizing the number of pairs ( one each from the positive and negative classes ) where the positive sample is not ranked higher than the negative sample : so , the number of zero entries in z equals the number of pairs where this condition is not true . For a given z , we have that , AUC = ( n− ∥z∥0 ) / ( |X+| |X−| ) = ( n− ∑ i ∑ j ϵ−1relu ( 0 , −zij + ϵ ) ) / ( |X+| |X−| ) . If zij is 0 , then ϵ−1relu ( 0 , −zij + ϵ ) equals 1 . Otherwise zij > 0 , it follows from the first constraint in ( 1 ) , that zij ≥ ϵ , so ϵ−1relu ( 0 , −zij + ϵ ) equals 0 . Observe that in ( 1 ) , the number of constraints is |X||X−| , which is O ( n2 ) .
This paper addresses the classical topic of directly optimizing non-decomposable loss functions. Since these metrics can be computed via linear programs, it is sufficient to compute gradient through the LP solver. To that end, the authors propose to use a particular method for solving linear programs. In experiments, the resulting implementation outperforms the cross-entropy loss and mildly outperforms one recent baseline.
SP:76ae86cb0be31feacf85f95c6c90fdd19aee85a3
Differentiable Optimization of Generalized Nondecomposable Functions using Linear Programs
1 Introduction . Commonly used losses such as cross-entropy used in deep neural network ( DNN ) models can be expressed as a sum over the per-sample losses incurred by the current estimate of the model . This allows the direct use of mature optimization routines , and is sufficient for many use cases . But in applications ranging from ranking/retrieval to class imbalanced learning , the most suitable losses for the task do not admit a “ decompose over samples ” form . Examples include Area under the ROC curve ( AUC ) , multi-class variants of AUC , F -score , Precision at a fixed recall ( P @ R ) and others . Optimizing such measures in a scalable manner can pose challenges even in the shallow setting . For AUC maximization , we now know that convex surrogate losses can be used in a linear model Liu et al . [ 2018 ] , Natole et al . [ 2018 ] in the so-called ERM framework . These ideas have been incorporated within deep neural network models and solved using SGD type schemes in Liu et al . [ 2019 ] . Such results on stochastic and online data models have also been explored in Ataman et al . [ 2006 ] , Cortes and Mohri [ 2004 ] , Gao et al . [ 2013 ] . There are also available strategies for measures other 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) , virtual . than the AUC : Nan et al . [ 2012 ] , Dembczynski et al . [ 2011 ] give exact algorithms for optimizing F -score and Eban et al . [ 2017 ] , Ravi et al . [ 2020 ] proposes scalable methods for non-decomposable objectives which utilizes Lagrange multipliers to construct the proxy objectives . The authors in Mohapatra et al . [ 2018 ] discuss using a function that upper bounds ( structured ) hinge-loss to optimize average precision . Recently , Fathony and Kolter [ 2020 ] presented an adversarial prediction formulation for such nondecomposable measures , and showed that it is indeed possible to incorporate such measures within differentiable pipelines . Our work utilizes the simple observation that a number of these non-decomposable objectives can be expressed in the form of an integer program that can be relaxed to a linear program ( LP ) . Our approach is based on the premise that tackling the LP form of the non-decomposable objective as a module within the DNN , one which permits forward and reverse mode differentiation and can utilize in-built support for specialized GPU hardware in modern libraries such as PyTorch , is desirable . First , as long as a suitable LP formulation for an objective is available , the module may be directly used . Second , based on which scheme is used to solve the LP , one may be able to provide guarantees for the non-decomposable objective based on simple calculations ( e.g. , number of constraints , primal-dual gap ) . The current tools do not entirely address all these requirements . A characteristic of the LPs that arise from the nondecomposable losses mentioned above is that the constraints ( including the mini-batch of samples themselves ) are modified at each iteration – as a function of the updates to the representations of the data in the upstream layers . In Section 3 , we provide LP formulations of widely used nondecomposable terms , which fall squarely within the capabilities of our solver . In Section 4 , we show that the modified Newton ’ s algorithm in Mangasarian [ 2004 ] can be used for deep neural network ( DNN ) training in an end-to-end manner without requiring external solvers , where support for GPUs currently remains limited . Specifically , by exploiting self-concordance of the objective , we show that the algorithm can converge globally without line search . We then analyze the gradient properties of our approach , and some modifications to improve stability during backpropagation . Our experiments in Section 5 show that this scheme based on Mangasarian ’ s parametric exterior penalty formulation of the primal LP is a computationally effective and scalable strategy to solve LPs with a large number of constraints . On the practical side , we provide two ways to deal with the scaling issue when the constraint matrix is large . On the one hand , we show that sufficient dimension reduction can be used in our solver to solve the problem in a lower dimension space . On the other hand , when the matrix is sparse , with our new sparse implementation , we show that we can train Resnet-18 with 10× mini-batch size ( memory savings ) on a 2080TI Nvidia GPU . Our code is available , see Fig 1 for an overview of our solver for differentiating many popular nondecomposable objectives . 2 Related Works . Differentiable optimization of nondecomposable objectives . One closely related result to ours is Liu et al . [ 2019 ] which explored optimizing a surrogate loss of AUC using SGD type methods that made the stochastic AUC optimization more practical for deep neural networks . Compared with Liu et al . [ 2019 ] , our work enables optimizing many more types of nondecomposable objectives for deep neural networks , and relies on the LP reformulation instead of a surrogate loss . In Fathony and Kolter [ 2020 ] , ( the expected values of ) such metrics are approximated by LPs defined by predictor and adversary marginal distributions ( represented as square matrices ) . The ADMM solver in Fathony and Kolter [ 2020 ] , as we will see , inherits some drawbacks of ADMMs including higher memory footprint and slower convergence . Another body of work is the one involving the use of blackbox solvers Pogančić et al . [ 2019 ] , Berthet et al . [ 2020 ] which can be adapted to solve the nondecomposable objectives ( e.g. , reformulating as LPs ) . For example , one idea is to use appropriate ( infimal or gaussian ) convolution to construct approximations of the gradients through the LP . Song et al . [ 2016 ] proposes a using a task loss to perturb the loss and is similar in spirit to blackbox solvers – they both solve a sequence of perturbed argmax/argmin problems first , and then use carefully designed procedures for the backward gradient that often require at least one more solve of the optimization problem . We will discuss these properties later in the paper , and in our experiments . Differentiable LP solver . In principle , of course , backpropagating through a convex optimization model ( and in particular , LPs ) is quite possible . For LPs , we can take derivatives of the optimal value ( or the optimal solution ) of the model with respect to the LP parameters , and this can be accomplished by calling a powerful external solver . Often , this would involve the overhead of running the solver on the CPU . Solvers within CVXPY , are effective but due to their general-purpose nature , rely on interior point methods . OptNet Amos and Kolter [ 2017 ] is quite efficient but designed for quadratic programs ( QP ) : the theoretical results and its efficiency depends on factorizing a matrix in the quadratic term in the objective ( which is zero/non-invertible for LPs ) . The primal-dual properties and implicit differentiation for QPs do not easily translate to LPs due to the polyhedral geometry in LPs . The ideas in Meng et al . [ 2020 ] are only applicable when the number of constraints is approximately equal to the number of variables – an invalid assumption for the models that we study here . 3 Nondecomposable Functions and corresponding LP models . We first present a standard LP form and then reparameterize several generalized nondecomposable objectives in this way , summarized in a table in the appendix . We start with the binary AUC , extend it to multi-class AUC , and then later , discuss a ratio objective , F -score . The appendix also includes a discussion of other objectives that are amenable to our method . 3.1 Notations and Generalized LP formulation . Notations . We use the following notations : ( i ) n : number of samples used in training . ( ii ) X ∈ Rn×dimx : the explanatory features fed to a classifier ( e.g. , parameterized by w ) ; ( iii ) f ( xi ) ( or f ( i ) ) : a score function for the classifier where xi ∈ X ; ( iv ) Y ∈ { 0 , 1 } : target label and Ŷ ∈ { 0 , 1 } : predicted label for binary classification , both in Rn ; ( v ) A⊗B : Kronecker product of matrices A and B . ( vi ) Ir : Identity matrix of size r and 1 is the indicator function . ( vii ) Bk , p ( and B| , k′ ) gives the k-th row ( and k′-th ) column of B. LP formulation . We consider a general linear program ( LP ) that contains nonnegative variables as well as inequality and equality constraints . The form of the LP is given as max ũ , ṽ gT ũ+ hT ṽ subject to Eũ+ F ṽ ≤ p , Bũ+Gṽ = q ũ , ṽ ≥ 0 We can write it more succinctly as Variable z = [ ũ ṽ ] ; Coefficient c = [ −g − h ] ; Constraints A = [ E B −B F G −G ] T ; Constants b = [ p q − q ] T The corresponding primal LP can be written as , minz cT z subject to Az ≤ b , z ≥ 0 . 3.2 Maximizing AUC . The Area under the ROC Curve ( AUC ) calculates the probability that a classifier f ( · ) will rank a randomly chosen positive sample higher than a randomly chosen negative sample . AUC varies between 0 and 1 , where 1 represents all positives being ranked above the negatives . AUC may be estimated using the Wilcoxon-Mann-Whitney ( WMW ) Statistic Hanley and McNeil [ 1982 ] , as Definition 3.1 ( AUC ) . Let n be the number of samples . Let X+ ( and X− resp . ) be the set of positive ( and negative resp . ) samples such that |X+|+ |X−| = n where | · | is the cardinality of the set . Then , AUC is given as ( ∑|X+| i=1 ∑|X−| i=1 1f ( xi ) > f ( xj ) ) / ( |X+| |X−| ) for xi : i ∈ { 1 , · · · , n } . Here , we follow Ataman et al . [ 2006 ] to calculate the AUC based on the WMW statistic as follows . min zij |X+|∑ i=1 |X−|∑ j=1 zij s.t . f ( xi ) − f ( xj ) ≥ ϵ− zij where xi ∈ X+ , xj ∈ X− ; zij ≥ 0 , ( 1 ) where ϵ is a given constant . Problem ( 1 ) computes AUC indirectly by minimizing the number of pairs ( one each from the positive and negative classes ) where the positive sample is not ranked higher than the negative sample : so , the number of zero entries in z equals the number of pairs where this condition is not true . For a given z , we have that , AUC = ( n− ∥z∥0 ) / ( |X+| |X−| ) = ( n− ∑ i ∑ j ϵ−1relu ( 0 , −zij + ϵ ) ) / ( |X+| |X−| ) . If zij is 0 , then ϵ−1relu ( 0 , −zij + ϵ ) equals 1 . Otherwise zij > 0 , it follows from the first constraint in ( 1 ) , that zij ≥ ϵ , so ϵ−1relu ( 0 , −zij + ϵ ) equals 0 . Observe that in ( 1 ) , the number of constraints is |X||X−| , which is O ( n2 ) .
This paper approximates several nondecomposable functions (AUC and F1-score) as linear programmings and uses them as loss functions for network training. In the linear programmings, the constraints are indeterministic at each mini-batch, the number of constraints increases quadratically to the number of training samples, so some previous works are inapplicable here. So does the primal-dual based forward pass and the corresponding implicit differentiation for a backward pass.
SP:76ae86cb0be31feacf85f95c6c90fdd19aee85a3
Dynamic Backdoor Attacks Against Deep Neural Networks
1 INTRODUCTION . Recent research has shown that deep neural network ( DNN ) models are vulnerable to various security and privacy attacks ( Papernot et al. , 2016 ; 2017 ; Shokri et al. , 2017 ; Salem et al. , 2019 ; 2020 ; Tramèr et al. , 2016 ; Oh et al. , 2018 ) . One such attack that receives a large amount of attention is backdoor , where an adversary trains a DNN model which can intentionally misclassify any input with an added trigger ( a secret pattern constructed from a set of neighboring pixels ) to a specific target label . Backdoor attacks can cause severe security consequences . For instance , an adversary can implant a backdoor in an authentication system to grant herself unauthorized access . Existing backdoor attacks generate static triggers , in terms of fixed trigger pattern and location ( on the model input ) . For instance , Figure 1a shows an example of triggers constructed by BadNets ( Gu et al. , 2017 ) , one popular backdoor attack method , on the CelebA dataset ( Liu et al. , 2015 ) . As we can see , BadNets in this case uses a white square as a trigger and always places it in the top-left corner of an input . This static nature of triggers has been leveraged to create most of the current defenses against the backdoor attack ( Wang et al. , 2019 ; Liu et al. , 2019a ; Gao et al. , 2019 ) . In this paper , we propose the first class of backdooring techniques against deep neural network models that generate dynamic triggers , in terms of trigger pattern and location . We refer to our techniques as dynamic backdoor attacks . Figure 1b shows an example . Dynamic backdoor attacks offer the adversary more flexibility , as they allow triggers to have different patterns and locations . Moreover , our techniques largely reduce the efficacy of the current defense mechanisms demonstrated by our empirical evaluation . In addition , we extend our techniques to work for all labels of the backdoored DNN model , while the current backdoor attacks only focus on a single or a few target labels . This further increases the difficulty of our backdoors being mitigated . In total , we propose 3 different dynamic backdoor techniques , i.e. , Random Backdoor , Backdoor Generating Network ( BaN ) , and conditional Backdoor Generating Network ( c-BaN ) . In particular , the latter two attacks algorithmically generate triggers to mount backdoor attacks which are first of their kind . To demonstrate the effectiveness of our proposed techniques , we perform empirical analysis with three DNN model architectures over three benchmark datasets . All of our techniques achieve almost a perfect backdoor accuracy , i.e. , the accuracy of the backdoored model on the backdoored data is approximately 100 % , with a negligible utility loss . Moreover , we show that our techniques can bypass three state-of-the-art backdoor defense techniques , namely Neural Cleanse ( Wang et al. , 2019 ) , ABS ( Liu et al. , 2019a ) , and STRIP ( Gao et al. , 2019 ) . In general , our contributions can be summarized as follows : 1 ) We broaden the class of backdoor attacks by introducing the dynamic backdoor attacks . 2 ) We propose both BaN and c-BaN , which are the first algorithmic backdoor paradigm . 3 ) Our dynamic backdoor attacks achieve strong performance while bypassing the current state-of-the-art backdoor defense techniques . 2 RELATED WORK . Backdoor Attacks : Gu et al . ( Gu et al. , 2017 ) introduce BadNets , the first backdoor attack on DNN models . BadNets uses the MNIST dataset and a square-like trigger with a fixed location , to show the applicability of the backdoor attacks in the DNN settings . Liu et al . ( Liu et al. , 2019b ) later propose a more advanced backdooring technique , namely the Trojan attack . They simplify the threat model of BadNets by eliminating the need for access to the training data used to train the target model . The main difference between these two attacks ( BadNets and Trojan attacks ) and our work is that both attacks only consider static backdoors in terms of triggers ’ pattern and location . Our work extends the backdoor attacks to consider dynamic patterns and locations of the triggers . We focus on backdoor attacks against image classification models , but backdoor attacks can be extended to other scenarios , such as Federated Learning ( Wang et al. , 2020 ) , Video Recognition ( Zhao et al. , 2020 ) , Transfer Learning ( Yao et al. , 2019 ) , and Natural language processing ( NLP ) ( Chen et al. , 2020 ) . To increase the stealthiness of the backdoor , Saha et al . ( Saha et al. , 2020 ) propose to transform the backdoored images into benign-looking ones , which makes them harder to detect . Lie et al . ( Liu et al. , 2020 ) introduce another approach , namely , the reflection backdoor ( Refool ) , which hides the triggers using mathematical modeling of the physical reflection property . Another line of research focuses on exploring different methods of implementing backdoors into target models . Rakin et al . ( Rakin et al. , 2020 ) introduce the Targeted Bit Trojan ( TBT ) technique , which instead of training the target model , flips some bits in the target models ’ weights to make it misclassify all the inputs . Tang et al . ( Tang et al. , 2020 ) present a different approach , where the adversary appends a small Trojan module ( TrojanNet ) to the target model instead of fully retraining it . Defenses Against Backdoor Attacks : Wang et al . ( Wang et al. , 2019 ) propose Neural Cleanse ( NC ) , a backdoor defense method based on reverse engineering . For each output label , NC tries to generate the smallest trigger , which converts the output of all inputs applied with this trigger to that label . NC then uses anomaly detection to find if any of the generated triggers are actually a backdoor or not . Later , Liu et al . ( Liu et al. , 2019a ) propose another model-based defense , namely , ABS . ABS detects if a target model contains a backdoor or not , by analyzing the behaviour of the target model ’ s inner neurons when introducing different levels of stimulation . Also , Gao et al . ( Gao et al. , 2019 ) propose STRIP , a backdoor defense method based on manipulating the input , to find out if it is backdoored or not . More concretely , STRIP fuses the input with multiple clean data , one at a time . Then it queries the target model with the generated inputs , and calculate the entropy of the output labels . Backdoored inputs tend to have lower entropy than the clean ones . Besides the above , there are multiple other types of attacks against deep neural network models , such as adversarial examples ( Vorobeychik & Li , 2014 ; Carlini & Wagner , 2017 ; Li & Vorobeychik , 2015 ; Tramèr et al. , 2017 ; Xu et al. , 2018 ) , poisoning attack ( Jagielski et al. , 2018 ; Suciu et al. , 2018 ; Biggio et al. , 2012 ) , and property inference ( Ganju et al. , 2018 ; Melis et al. , 2019 ) . 3 DYNAMIC BACKDOORS . 3.1 THREAT MODEL . The dynamic backdoor attack is a training time attack , i.e. , the adversary is the one who trains the backdoored DNN model . To implement our attack , we assume the adversary controls the training of the target model and has access to the training data following previous works ( Gu et al. , 2017 ; Yao et al. , 2019 ; Chen et al. , 2020 ) . To launch the attack ( after publishing the model ) , the adversary first adds a trigger to the input and then uses it to query the backdoored model . This can happen either digitally , where the adversary digitally adds the trigger to the image , or physically , where the adversary prints the trigger and places it on the image . This added trigger makes the backdoored model misclassify the input to the target label . 3.2 RANDOM BACKDOOR . We start by presenting our Random Backdoor technique . Abstractly , the Random Backdoor technique constructs triggers by sampling them from a uniform distribution , and adding them to the inputs at random locations . We first introduce using Random Backdoor to implement a dynamic backdoor for a single target label , then we generalize it to multiple target labels . Single Target Label : In this setting , we construct a set of triggers ( T ) and a set of possible locations ( K ) , such that for any trigger sampled from T and added to any input at a random location sampled from K , the model will output the specified target label . More formally , for any location κi ∈ K , any trigger ti ∈ T , and any input xi ∈ X : Mbd ( A ( xi , ti , κi ) ) = ` , where ` is the target label , T is the set of triggers , K is the set of locations , Mbd is the backdoored model , and A is the backdoor adding function ( it adds the trigger ti to the input xi at the location κi ) . To implement such a backdoor , an adversary needs to first select her desired trigger locations and create the set of possible locations K. Then , she uses both clean and backdoored data to update the model for each epoch similar to the BadNets technique but with two differences . First , instead of using a fixed trigger for all inputs , each time the adversary wants to add a trigger to an input , she samples a new trigger from a uniform distribution , i.e. , t ∼ U ( 0 , 1 ) . Here , the set of possible triggers T contains the full range of all possible values for the triggers , since the trigger is randomly sampled from a uniform distribution . Second , instead of placing the trigger in a fixed location , she places it at a random location κ , sampled from the predefined set of locations , i.e. , κ ∈ K. Note that Random Backdoor is not only limited to uniform distribution , other distributions , such as Gaussian distribution , can be used as well . Multiple Target Labels : Next , we consider the more complex case of having multiple target labels . Without loss of generality , we consider implementing a backdoor for each label in the dataset . This means that for any label ` i ∈ L , there exists a trigger t which when added to the input x at a location κ , will make the modelMbd output ` i . More formally , ∀ ` i ∈ L ∃ t , κ : Mbd ( A ( x , t , κ ) ) = ` i . To achieve the dynamic backdoor behaviour , each target label should have a set of possible triggers and a set of possible locations . We generalize the Random Backdoor technique by dividing the set of possible locations K into disjoint subsets for each target label , while keeping the trigger construction method the same as in the single target label case , i.e. , the triggers are still sampled from a uniform distribution . For instance , for the target label ` i , we sample a set of possible locations Ki , where Ki is subset of K ( Ki ⊂ K ) . The adversary can construct the disjoint sets in two steps . First , the adversary selects all possible triggers locations and constructs the set K. Second , for each target label ` i , she constructs the set of possible locations for this label Ki by sampling the set K. Then , she removes the sampled locations from the set K. We propose a simple algorithm to assign the locations for the different target labels . Concretely , we uniformly split the image into non-intersecting regions , and assign a region for each target label , in which the triggers ’ locations can move vertically . Figure 2 shows an example of our location setting technique for a use case with 6 target labels . We stress that this is one way of dividing the location set K to the different target labels . However , an adversary can choose a different way of splitting the locations inside K to the different target labels . The only requirement the adversary has to fulfill is to avoid assigning a location for different target labels . Later , we will show how to overcome this limitation with our more advanced c-BaN technique .
This paper proposed a class of methods for dynamic backdoor attack. The main idea is to generate different backdoor patterns and locations in backdoor attack. The threat model is the attacker has full access to the training data and the model training procedure. Both single-target and multi-target class-conditional triggers were explored. Experimental results on three datasets in the 100% poisoning setting verified the effectiveness of the proposed attack.
SP:6bfdc3596045227aaed04a50cd934e5d4bc1e9ad
Dynamic Backdoor Attacks Against Deep Neural Networks
1 INTRODUCTION . Recent research has shown that deep neural network ( DNN ) models are vulnerable to various security and privacy attacks ( Papernot et al. , 2016 ; 2017 ; Shokri et al. , 2017 ; Salem et al. , 2019 ; 2020 ; Tramèr et al. , 2016 ; Oh et al. , 2018 ) . One such attack that receives a large amount of attention is backdoor , where an adversary trains a DNN model which can intentionally misclassify any input with an added trigger ( a secret pattern constructed from a set of neighboring pixels ) to a specific target label . Backdoor attacks can cause severe security consequences . For instance , an adversary can implant a backdoor in an authentication system to grant herself unauthorized access . Existing backdoor attacks generate static triggers , in terms of fixed trigger pattern and location ( on the model input ) . For instance , Figure 1a shows an example of triggers constructed by BadNets ( Gu et al. , 2017 ) , one popular backdoor attack method , on the CelebA dataset ( Liu et al. , 2015 ) . As we can see , BadNets in this case uses a white square as a trigger and always places it in the top-left corner of an input . This static nature of triggers has been leveraged to create most of the current defenses against the backdoor attack ( Wang et al. , 2019 ; Liu et al. , 2019a ; Gao et al. , 2019 ) . In this paper , we propose the first class of backdooring techniques against deep neural network models that generate dynamic triggers , in terms of trigger pattern and location . We refer to our techniques as dynamic backdoor attacks . Figure 1b shows an example . Dynamic backdoor attacks offer the adversary more flexibility , as they allow triggers to have different patterns and locations . Moreover , our techniques largely reduce the efficacy of the current defense mechanisms demonstrated by our empirical evaluation . In addition , we extend our techniques to work for all labels of the backdoored DNN model , while the current backdoor attacks only focus on a single or a few target labels . This further increases the difficulty of our backdoors being mitigated . In total , we propose 3 different dynamic backdoor techniques , i.e. , Random Backdoor , Backdoor Generating Network ( BaN ) , and conditional Backdoor Generating Network ( c-BaN ) . In particular , the latter two attacks algorithmically generate triggers to mount backdoor attacks which are first of their kind . To demonstrate the effectiveness of our proposed techniques , we perform empirical analysis with three DNN model architectures over three benchmark datasets . All of our techniques achieve almost a perfect backdoor accuracy , i.e. , the accuracy of the backdoored model on the backdoored data is approximately 100 % , with a negligible utility loss . Moreover , we show that our techniques can bypass three state-of-the-art backdoor defense techniques , namely Neural Cleanse ( Wang et al. , 2019 ) , ABS ( Liu et al. , 2019a ) , and STRIP ( Gao et al. , 2019 ) . In general , our contributions can be summarized as follows : 1 ) We broaden the class of backdoor attacks by introducing the dynamic backdoor attacks . 2 ) We propose both BaN and c-BaN , which are the first algorithmic backdoor paradigm . 3 ) Our dynamic backdoor attacks achieve strong performance while bypassing the current state-of-the-art backdoor defense techniques . 2 RELATED WORK . Backdoor Attacks : Gu et al . ( Gu et al. , 2017 ) introduce BadNets , the first backdoor attack on DNN models . BadNets uses the MNIST dataset and a square-like trigger with a fixed location , to show the applicability of the backdoor attacks in the DNN settings . Liu et al . ( Liu et al. , 2019b ) later propose a more advanced backdooring technique , namely the Trojan attack . They simplify the threat model of BadNets by eliminating the need for access to the training data used to train the target model . The main difference between these two attacks ( BadNets and Trojan attacks ) and our work is that both attacks only consider static backdoors in terms of triggers ’ pattern and location . Our work extends the backdoor attacks to consider dynamic patterns and locations of the triggers . We focus on backdoor attacks against image classification models , but backdoor attacks can be extended to other scenarios , such as Federated Learning ( Wang et al. , 2020 ) , Video Recognition ( Zhao et al. , 2020 ) , Transfer Learning ( Yao et al. , 2019 ) , and Natural language processing ( NLP ) ( Chen et al. , 2020 ) . To increase the stealthiness of the backdoor , Saha et al . ( Saha et al. , 2020 ) propose to transform the backdoored images into benign-looking ones , which makes them harder to detect . Lie et al . ( Liu et al. , 2020 ) introduce another approach , namely , the reflection backdoor ( Refool ) , which hides the triggers using mathematical modeling of the physical reflection property . Another line of research focuses on exploring different methods of implementing backdoors into target models . Rakin et al . ( Rakin et al. , 2020 ) introduce the Targeted Bit Trojan ( TBT ) technique , which instead of training the target model , flips some bits in the target models ’ weights to make it misclassify all the inputs . Tang et al . ( Tang et al. , 2020 ) present a different approach , where the adversary appends a small Trojan module ( TrojanNet ) to the target model instead of fully retraining it . Defenses Against Backdoor Attacks : Wang et al . ( Wang et al. , 2019 ) propose Neural Cleanse ( NC ) , a backdoor defense method based on reverse engineering . For each output label , NC tries to generate the smallest trigger , which converts the output of all inputs applied with this trigger to that label . NC then uses anomaly detection to find if any of the generated triggers are actually a backdoor or not . Later , Liu et al . ( Liu et al. , 2019a ) propose another model-based defense , namely , ABS . ABS detects if a target model contains a backdoor or not , by analyzing the behaviour of the target model ’ s inner neurons when introducing different levels of stimulation . Also , Gao et al . ( Gao et al. , 2019 ) propose STRIP , a backdoor defense method based on manipulating the input , to find out if it is backdoored or not . More concretely , STRIP fuses the input with multiple clean data , one at a time . Then it queries the target model with the generated inputs , and calculate the entropy of the output labels . Backdoored inputs tend to have lower entropy than the clean ones . Besides the above , there are multiple other types of attacks against deep neural network models , such as adversarial examples ( Vorobeychik & Li , 2014 ; Carlini & Wagner , 2017 ; Li & Vorobeychik , 2015 ; Tramèr et al. , 2017 ; Xu et al. , 2018 ) , poisoning attack ( Jagielski et al. , 2018 ; Suciu et al. , 2018 ; Biggio et al. , 2012 ) , and property inference ( Ganju et al. , 2018 ; Melis et al. , 2019 ) . 3 DYNAMIC BACKDOORS . 3.1 THREAT MODEL . The dynamic backdoor attack is a training time attack , i.e. , the adversary is the one who trains the backdoored DNN model . To implement our attack , we assume the adversary controls the training of the target model and has access to the training data following previous works ( Gu et al. , 2017 ; Yao et al. , 2019 ; Chen et al. , 2020 ) . To launch the attack ( after publishing the model ) , the adversary first adds a trigger to the input and then uses it to query the backdoored model . This can happen either digitally , where the adversary digitally adds the trigger to the image , or physically , where the adversary prints the trigger and places it on the image . This added trigger makes the backdoored model misclassify the input to the target label . 3.2 RANDOM BACKDOOR . We start by presenting our Random Backdoor technique . Abstractly , the Random Backdoor technique constructs triggers by sampling them from a uniform distribution , and adding them to the inputs at random locations . We first introduce using Random Backdoor to implement a dynamic backdoor for a single target label , then we generalize it to multiple target labels . Single Target Label : In this setting , we construct a set of triggers ( T ) and a set of possible locations ( K ) , such that for any trigger sampled from T and added to any input at a random location sampled from K , the model will output the specified target label . More formally , for any location κi ∈ K , any trigger ti ∈ T , and any input xi ∈ X : Mbd ( A ( xi , ti , κi ) ) = ` , where ` is the target label , T is the set of triggers , K is the set of locations , Mbd is the backdoored model , and A is the backdoor adding function ( it adds the trigger ti to the input xi at the location κi ) . To implement such a backdoor , an adversary needs to first select her desired trigger locations and create the set of possible locations K. Then , she uses both clean and backdoored data to update the model for each epoch similar to the BadNets technique but with two differences . First , instead of using a fixed trigger for all inputs , each time the adversary wants to add a trigger to an input , she samples a new trigger from a uniform distribution , i.e. , t ∼ U ( 0 , 1 ) . Here , the set of possible triggers T contains the full range of all possible values for the triggers , since the trigger is randomly sampled from a uniform distribution . Second , instead of placing the trigger in a fixed location , she places it at a random location κ , sampled from the predefined set of locations , i.e. , κ ∈ K. Note that Random Backdoor is not only limited to uniform distribution , other distributions , such as Gaussian distribution , can be used as well . Multiple Target Labels : Next , we consider the more complex case of having multiple target labels . Without loss of generality , we consider implementing a backdoor for each label in the dataset . This means that for any label ` i ∈ L , there exists a trigger t which when added to the input x at a location κ , will make the modelMbd output ` i . More formally , ∀ ` i ∈ L ∃ t , κ : Mbd ( A ( x , t , κ ) ) = ` i . To achieve the dynamic backdoor behaviour , each target label should have a set of possible triggers and a set of possible locations . We generalize the Random Backdoor technique by dividing the set of possible locations K into disjoint subsets for each target label , while keeping the trigger construction method the same as in the single target label case , i.e. , the triggers are still sampled from a uniform distribution . For instance , for the target label ` i , we sample a set of possible locations Ki , where Ki is subset of K ( Ki ⊂ K ) . The adversary can construct the disjoint sets in two steps . First , the adversary selects all possible triggers locations and constructs the set K. Second , for each target label ` i , she constructs the set of possible locations for this label Ki by sampling the set K. Then , she removes the sampled locations from the set K. We propose a simple algorithm to assign the locations for the different target labels . Concretely , we uniformly split the image into non-intersecting regions , and assign a region for each target label , in which the triggers ’ locations can move vertically . Figure 2 shows an example of our location setting technique for a use case with 6 target labels . We stress that this is one way of dividing the location set K to the different target labels . However , an adversary can choose a different way of splitting the locations inside K to the different target labels . The only requirement the adversary has to fulfill is to avoid assigning a location for different target labels . Later , we will show how to overcome this limitation with our more advanced c-BaN technique .
This paper outlines improved backdoor attacks for deep neural networks. Backdoor attacks are training-time attacks whereby an adveresary trains a network in such a way that it functions as a classifier on honestly generated images, but it has the added caveat of also being able to misclassify on images corrupted via a "trigger" set by an adversary. This is a grave security concern, and as such there is substantial literature that relates to both systematically training backdoored DNNs, and also detecting when a trained DNN has a backdoor.
SP:6bfdc3596045227aaed04a50cd934e5d4bc1e9ad
Information Laundering for Model Privacy
1 INTRODUCTION . An emerging number of applications involve the following user-scenario . Alice developed a model that takes a specific query as input and calculates a response as output . The model is a stochastic black-box that may represent a novel type of ensemble models , a known deep neural network architecture with sophisticated parameter tuning , or a physical law described by stochastic differential equations . Bob is a user that sends a query to Alice and obtains the corresponding response for his specific purposes , whether benign or adversarial . Examples of the above scenario include many recent Machine-Learning-as-a-Service ( MLaaS ) services ( Alabbadi , 2011 ; Ribeiro et al. , 2015 ; Xian et al. , 2020 ) and artificial intelligence chips , where Alice represents a learning service provider , and Bob represents users . Suppose that Bob obtains sufficient paired input-output data as generated from Alice ’ s black-box model , it is conceivable that Bob could treat it as supervised data and reconstruct Alice ’ s model to some extent . From the view of Alice , her model may be treated as valuable and private . As Bob who queries the model may be benign or adversarial , Alice may intend to offer limited utility for the return of enhanced privacy . The above concern naturally motivates the following problem . ( Q1 ) How to enhance the privacy for an already-learned model ? Note that the above problem is not about data privacy , where the typical goal is to prevent adversarial inference of the data information during data transmission or model training . In contrast , model privacy concerns an alreadyestablished model . We propose to study a general approach to jointly maneuver the original query ’ s input and output so that Bob finds it challenging to guess Alice ’ s core model . As illustrated in Figure 1a , Alice ’ s model is treated as a transition kernel ( or communication channel ) that produces Ỹ conditional on any given X̃ . Compared with an honest service Alice would have provided ( Figure 1b ) , the input X̃ is a maneuvered version of Bob ’ s original inputX ; Moreover , Alice may choose ( a ) ( b ) to return a perturbed outcome Y instead of Ỹ to Bob . Consequently , the apparent kernel from Bob ’ s input queryX to the output response Y is a cascade of three kernels , denoted byK in Figure 1a . The above perspective provides a natural and general framework to study model privacy . Admittedly , if Alice produces a ( nearly ) random response , adversaries will find it difficult to steal the model , while benign users will find it useless . Consequently , we raise another problem . ( Q2 ) How to formulate the model privacy-utility tradeoff , and what is the optimal way of imposing privacy ? To address this question , we formulate a model privacy framework from an informationtheoretic perspective , named information laundering . We briefly describe the idea below . The general goal is to jointly design the input and output kernels ( K1 and K2 in Figure 1a ) that deliberately maneuver the intended input and output for queries of the model so that 1 ) the effective kernel ( K in Figure 1a ) for Bob is not too far away from the original kernel ( K∗ in Figure 1a ) , and 2 ) adversarial acquisition of the model becomes difficult . Alternatively , Alice ‘ launders ’ the input-output information maximally given a fixed utility loss . To find the optimal way of information laundering , we propose an objective function that involves two components : the first being the information shared between X , X̃ and between Ỹ , Y , and the second being the average Kullback-Leibler ( KL ) divergence between the conditional distribution describing K and K∗ . Intuitively , the first component controls the difficulty of guessing K∗ sandwiched between two artificial kernels K1 and K2 , while the second component ensures that overall utility is maximized under the same privacy constraints . By optimizing the objective for varying weights between the components , we can quantify the fundamental tradeoffs between model utility and privacy . 1.1 RELATED WORK . We introduce some closely related literature below . Section 3.3 will incorporate more technical discussions on some related but different frameworks , including information bottleneck , local data privacy , information privacy , and adversarial model attack . A closely related subject of study is data privacy , which has received extensive attention in recent years due to societal concerns ( Voigt & Von dem Bussche , 2017 ; Evans et al. , 2015 ; Cross & Cavallaro , 2020 ; Google , 2019 ; Facebook , 2020 ) . Data privacy concerns the protection of ( usually personal ) data information from different perspectives , including lossless cryptography ( Yao , 1982 ; Chaum et al. , 1988 ) , randomized data collection ( Evfimievski et al. , 2003 ; Kasiviswanathan et al. , 2011 ; Ding & Ding , 2020 ) , statistical database query ( Dwork & Nissim , 2004 ; Dwork , 2011 ) , membership inference ( Shokri et al. , 2017 ) , and Federated learning ( Shokri & Shmatikov , 2015 ; Konevcny et al. , 2016 ; McMahan et al. , 2017 ; Yang et al. , 2019 ; Diao et al. , 2020 ) . A common goal in data privacy is to obfuscate individual-level data values while still enabling population-wide learning . In contrast , the subject of model privacy focuses on protecting a single learned model ready to deploy . For example , we want to privatize a classifier to deploy on the cloud for public use , whether the model is previously trained from raw image data or a data-private procedure . Another closely related subject is the model extraction in ( Tramèr et al. , 2016 ; Papernot et al. , 2016b ) , where Bob ’ s goal is to reconstruct Alice ’ s model from several queries ’ inputs and outputs , knowing what specific model Alice uses . For example , suppose that Alice ’ s model is a generalized linear regression with p features . In that case , it is likely to be reconstructed using p queries of the expected mean ( a known function ofXβ ) by solving equations ( Tramèr et al. , 2016 ) . In the supervised classification scenario , when only labels are returned to any given input , model extraction could be cast as an active learning problem where the goal is to query most efficiently ( Chandrasekaran et al. , 2018 ) . Model extraction was also studied in contexts beyond the prediction API , e.g. , when an adversary utilizes the gradient information ( Milli et al. , 2019 ) . From Alice ’ s perspective , there exist several solutions to safeguard against model leakage . A warning-based method was developed in ( Kesarwani et al. , 2018 ) , where Alice continuously monitors the information gain and raise alarms when they become unusual . Another warning method was developed in ( Juuti et al. , 2019 ) , where the detection of an adversary is based on testing whether the pairwise distances among queried data approximately follow the Gaussian distribution . The work in ( Lee et al. , 2018 ) developed a defense strategy for the setting where the target is a classifier , and the adversary queries each class ’ s probability . The probabilities are maximally perturbed under the constraint that the most-likely class label ) remains the same . The work in ( Orekondy et al. , 2019 ) studied a similar setting but from a different perspective . The main idea is to perturb the probabilities within an ` 2-distance constraint to poison the adversary ’ s gradient signals . 1.2 CONTRIBUTIONS AND OUTLINE . The main contributions of this work are three folds . First , we develop a novel concept , theory , and method , generally referred to as information laundering , to study model privacy . Unlike data privacy that concerns the protection of raw data information , model privacy aims to privatize an already-learned model for public use . To the best of the authors ’ knowledge , this work is the first framework to study model privacy in a principled manner . Second , under the developed informationtheoretic framework , we cast the tradeoffs between model privacy and utility as a general optimization problem . We derive the optimal solution using the calculus of variations and provide extensive discussions on the solution ’ s insights from different angles . Third , we develop a concrete algorithm , prove its convergence , and elaborate on some specific cases . We also provide some experimental studies to illustrate the concepts , and discuss several future problems at the end . The paper is organized as follows . In Section 2 , we describe the problem formulation and a general approach to protect the model . In Section 3 , we propose the information laundering method that casts the model privacy-utility tradeoff as an optimization problem and derives a general solution . In Section 3.3 , we provide some additional discussions of the related frameworks , including information bottleneck , local data privacy , information privacy , and adversarial model attack . In Section 5 , we conclude the paper with some potential future work . In the Appendix , we provide the proofs of the main results and experimental studies . 2 FORMULATION . 2.1 BACKGROUND . The private model can be obtained from general learning methods , and its deployment means that it will return a response for a given input query . Suppose that X and Y are the input and output alphabets ( data space ) , respectively . Definition 1 ( Learned model ) A learned model is a kernel p : X × Y → [ 0 , 1 ] , which induces a class of conditional distributions { p ( · | x ) : x ∈ X } . A model in the above definition is also referred to as a communication channel in information theory . A model can be regarded as the input-output ( or Alice ’ s application programming interface , API ) offered to Bob . Examples include a regression/classification model that outputs predicted labels , a clustering model that outputs the probabilities of belonging to specific groups , and a stochastic differential equation system that outputs the likely paths for various inputs variables . It does not matter where the model comes from since we are only concerned about the privacy of a fixed given model . The ( authentic ) model of Alice is denoted by pK∗ . An adversary Bob is a user that can access the above model ’ s API , providing an arbitrary input , X , and obtaining an output , Y . Bob aims to use as few queries as possible to construct a model that closely matches Alice ’ s model pK∗ . We will formalize the ‘ closeness ’ using the KL divergence . What is model privacy ? Our perspective is that privacy is not an intrinsic quantity associated with a model ; instead , it is a measure of information that arises from interactions between the model and its queries . In our context , the interactions are throughX ( offered by Bob ) and Y ( offered by Alice ) . The key idea of enhancing Alice ’ s model privacy is to let Alice output noisy predictions Ỹ for any input X so that Bob can not easily infer Alice ’ s original model . Similarly , Alice may choose to manipulate X as well before passing it through K∗ . Alternatively , Alice intends to 1 ) impose some ambiguity between X , X̃ , and between Y , Ỹ , which conceivably will produce response deviating from the original one , and 2 ) seek theK closest toK∗ under the same amount of ambiguity imposed . Motivated by the above concepts , we introduce the following notion . Definition 2 ( Information-laundered model ) A information-laundered model with respect to a given model K∗ is a model K that consists of three internal kernels K = K1 ◦ K∗ ◦ K2 ( illustrated in Figure 1 ) . Naturally , the information-laundered model of Alice is denoted by pK .
This paper aims to tackle the problem of model stealing/extraction, as in stealing a model that is deployed remotely, through API access. The threat model that they are aiming to protect against is not well-defined. The proposed method is information theoretic. They propose adding two modules (kernels) before and after the main deployed model, to "launder" information. The loss function for achieving the desired modules consists of two main terms, for utility, and privacy of the model. The utility term tries to keep the expected value of the output being accurate high, while the privacy term (which are actually two terms for the two modules) try to decrease the MI between the true output/input and the laundered ones. They then offer an iterative approach for minimizing the loss.
SP:ac5c618268cfa8b094aa4c7906c3bc6427035da5
Information Laundering for Model Privacy
1 INTRODUCTION . An emerging number of applications involve the following user-scenario . Alice developed a model that takes a specific query as input and calculates a response as output . The model is a stochastic black-box that may represent a novel type of ensemble models , a known deep neural network architecture with sophisticated parameter tuning , or a physical law described by stochastic differential equations . Bob is a user that sends a query to Alice and obtains the corresponding response for his specific purposes , whether benign or adversarial . Examples of the above scenario include many recent Machine-Learning-as-a-Service ( MLaaS ) services ( Alabbadi , 2011 ; Ribeiro et al. , 2015 ; Xian et al. , 2020 ) and artificial intelligence chips , where Alice represents a learning service provider , and Bob represents users . Suppose that Bob obtains sufficient paired input-output data as generated from Alice ’ s black-box model , it is conceivable that Bob could treat it as supervised data and reconstruct Alice ’ s model to some extent . From the view of Alice , her model may be treated as valuable and private . As Bob who queries the model may be benign or adversarial , Alice may intend to offer limited utility for the return of enhanced privacy . The above concern naturally motivates the following problem . ( Q1 ) How to enhance the privacy for an already-learned model ? Note that the above problem is not about data privacy , where the typical goal is to prevent adversarial inference of the data information during data transmission or model training . In contrast , model privacy concerns an alreadyestablished model . We propose to study a general approach to jointly maneuver the original query ’ s input and output so that Bob finds it challenging to guess Alice ’ s core model . As illustrated in Figure 1a , Alice ’ s model is treated as a transition kernel ( or communication channel ) that produces Ỹ conditional on any given X̃ . Compared with an honest service Alice would have provided ( Figure 1b ) , the input X̃ is a maneuvered version of Bob ’ s original inputX ; Moreover , Alice may choose ( a ) ( b ) to return a perturbed outcome Y instead of Ỹ to Bob . Consequently , the apparent kernel from Bob ’ s input queryX to the output response Y is a cascade of three kernels , denoted byK in Figure 1a . The above perspective provides a natural and general framework to study model privacy . Admittedly , if Alice produces a ( nearly ) random response , adversaries will find it difficult to steal the model , while benign users will find it useless . Consequently , we raise another problem . ( Q2 ) How to formulate the model privacy-utility tradeoff , and what is the optimal way of imposing privacy ? To address this question , we formulate a model privacy framework from an informationtheoretic perspective , named information laundering . We briefly describe the idea below . The general goal is to jointly design the input and output kernels ( K1 and K2 in Figure 1a ) that deliberately maneuver the intended input and output for queries of the model so that 1 ) the effective kernel ( K in Figure 1a ) for Bob is not too far away from the original kernel ( K∗ in Figure 1a ) , and 2 ) adversarial acquisition of the model becomes difficult . Alternatively , Alice ‘ launders ’ the input-output information maximally given a fixed utility loss . To find the optimal way of information laundering , we propose an objective function that involves two components : the first being the information shared between X , X̃ and between Ỹ , Y , and the second being the average Kullback-Leibler ( KL ) divergence between the conditional distribution describing K and K∗ . Intuitively , the first component controls the difficulty of guessing K∗ sandwiched between two artificial kernels K1 and K2 , while the second component ensures that overall utility is maximized under the same privacy constraints . By optimizing the objective for varying weights between the components , we can quantify the fundamental tradeoffs between model utility and privacy . 1.1 RELATED WORK . We introduce some closely related literature below . Section 3.3 will incorporate more technical discussions on some related but different frameworks , including information bottleneck , local data privacy , information privacy , and adversarial model attack . A closely related subject of study is data privacy , which has received extensive attention in recent years due to societal concerns ( Voigt & Von dem Bussche , 2017 ; Evans et al. , 2015 ; Cross & Cavallaro , 2020 ; Google , 2019 ; Facebook , 2020 ) . Data privacy concerns the protection of ( usually personal ) data information from different perspectives , including lossless cryptography ( Yao , 1982 ; Chaum et al. , 1988 ) , randomized data collection ( Evfimievski et al. , 2003 ; Kasiviswanathan et al. , 2011 ; Ding & Ding , 2020 ) , statistical database query ( Dwork & Nissim , 2004 ; Dwork , 2011 ) , membership inference ( Shokri et al. , 2017 ) , and Federated learning ( Shokri & Shmatikov , 2015 ; Konevcny et al. , 2016 ; McMahan et al. , 2017 ; Yang et al. , 2019 ; Diao et al. , 2020 ) . A common goal in data privacy is to obfuscate individual-level data values while still enabling population-wide learning . In contrast , the subject of model privacy focuses on protecting a single learned model ready to deploy . For example , we want to privatize a classifier to deploy on the cloud for public use , whether the model is previously trained from raw image data or a data-private procedure . Another closely related subject is the model extraction in ( Tramèr et al. , 2016 ; Papernot et al. , 2016b ) , where Bob ’ s goal is to reconstruct Alice ’ s model from several queries ’ inputs and outputs , knowing what specific model Alice uses . For example , suppose that Alice ’ s model is a generalized linear regression with p features . In that case , it is likely to be reconstructed using p queries of the expected mean ( a known function ofXβ ) by solving equations ( Tramèr et al. , 2016 ) . In the supervised classification scenario , when only labels are returned to any given input , model extraction could be cast as an active learning problem where the goal is to query most efficiently ( Chandrasekaran et al. , 2018 ) . Model extraction was also studied in contexts beyond the prediction API , e.g. , when an adversary utilizes the gradient information ( Milli et al. , 2019 ) . From Alice ’ s perspective , there exist several solutions to safeguard against model leakage . A warning-based method was developed in ( Kesarwani et al. , 2018 ) , where Alice continuously monitors the information gain and raise alarms when they become unusual . Another warning method was developed in ( Juuti et al. , 2019 ) , where the detection of an adversary is based on testing whether the pairwise distances among queried data approximately follow the Gaussian distribution . The work in ( Lee et al. , 2018 ) developed a defense strategy for the setting where the target is a classifier , and the adversary queries each class ’ s probability . The probabilities are maximally perturbed under the constraint that the most-likely class label ) remains the same . The work in ( Orekondy et al. , 2019 ) studied a similar setting but from a different perspective . The main idea is to perturb the probabilities within an ` 2-distance constraint to poison the adversary ’ s gradient signals . 1.2 CONTRIBUTIONS AND OUTLINE . The main contributions of this work are three folds . First , we develop a novel concept , theory , and method , generally referred to as information laundering , to study model privacy . Unlike data privacy that concerns the protection of raw data information , model privacy aims to privatize an already-learned model for public use . To the best of the authors ’ knowledge , this work is the first framework to study model privacy in a principled manner . Second , under the developed informationtheoretic framework , we cast the tradeoffs between model privacy and utility as a general optimization problem . We derive the optimal solution using the calculus of variations and provide extensive discussions on the solution ’ s insights from different angles . Third , we develop a concrete algorithm , prove its convergence , and elaborate on some specific cases . We also provide some experimental studies to illustrate the concepts , and discuss several future problems at the end . The paper is organized as follows . In Section 2 , we describe the problem formulation and a general approach to protect the model . In Section 3 , we propose the information laundering method that casts the model privacy-utility tradeoff as an optimization problem and derives a general solution . In Section 3.3 , we provide some additional discussions of the related frameworks , including information bottleneck , local data privacy , information privacy , and adversarial model attack . In Section 5 , we conclude the paper with some potential future work . In the Appendix , we provide the proofs of the main results and experimental studies . 2 FORMULATION . 2.1 BACKGROUND . The private model can be obtained from general learning methods , and its deployment means that it will return a response for a given input query . Suppose that X and Y are the input and output alphabets ( data space ) , respectively . Definition 1 ( Learned model ) A learned model is a kernel p : X × Y → [ 0 , 1 ] , which induces a class of conditional distributions { p ( · | x ) : x ∈ X } . A model in the above definition is also referred to as a communication channel in information theory . A model can be regarded as the input-output ( or Alice ’ s application programming interface , API ) offered to Bob . Examples include a regression/classification model that outputs predicted labels , a clustering model that outputs the probabilities of belonging to specific groups , and a stochastic differential equation system that outputs the likely paths for various inputs variables . It does not matter where the model comes from since we are only concerned about the privacy of a fixed given model . The ( authentic ) model of Alice is denoted by pK∗ . An adversary Bob is a user that can access the above model ’ s API , providing an arbitrary input , X , and obtaining an output , Y . Bob aims to use as few queries as possible to construct a model that closely matches Alice ’ s model pK∗ . We will formalize the ‘ closeness ’ using the KL divergence . What is model privacy ? Our perspective is that privacy is not an intrinsic quantity associated with a model ; instead , it is a measure of information that arises from interactions between the model and its queries . In our context , the interactions are throughX ( offered by Bob ) and Y ( offered by Alice ) . The key idea of enhancing Alice ’ s model privacy is to let Alice output noisy predictions Ỹ for any input X so that Bob can not easily infer Alice ’ s original model . Similarly , Alice may choose to manipulate X as well before passing it through K∗ . Alternatively , Alice intends to 1 ) impose some ambiguity between X , X̃ , and between Y , Ỹ , which conceivably will produce response deviating from the original one , and 2 ) seek theK closest toK∗ under the same amount of ambiguity imposed . Motivated by the above concepts , we introduce the following notion . Definition 2 ( Information-laundered model ) A information-laundered model with respect to a given model K∗ is a model K that consists of three internal kernels K = K1 ◦ K∗ ◦ K2 ( illustrated in Figure 1 ) . Naturally , the information-laundered model of Alice is denoted by pK .
This paper studies model privacy and its privacy and utility tradeoff. In particular, the authors proposed information laundered model where the input and output of the true model are perturbed. The objective is to minimize the KL divergence between the true model and laundered model with mutual information between input and output as constraints. Theoretically, they show the optimal condition of the above optimization problem and provides an iterative algorithm.
SP:ac5c618268cfa8b094aa4c7906c3bc6427035da5
Generative Time-series Modeling with Fourier Flows
1 INTRODUCTION . Lack of access to data is a key hindrance to the development of machine learning solutions in application domains where data sharing may lead to privacy breaches ( Walonoski et al . ( 2018 ) ) . Areas where this problem is most conspicuous include medicine , where access to ( highly-sensitive ) clinical data is stringently regulated by medical institutions ; such strict regulations undermine scientific progress by hindering model development and reproducibility . Generative models that produce sensible and realistic synthetic data present a viable solution to this problem—artificially-generated data sets produced by such models can be shared widely without privacy concerns ( Buczak et al . ( 2010 ) ) . In this paper , we focus on the time-series data setup , where observations are collected sequentially over arbitrary periods of time with different observation frequencies across different features . This general data setup is pervasive in the medical domain—it captures the kind of data maintained in electronic health records ( Shickel et al . ( 2017 ) ) or collected in intensive care units ( Johnson et al . ( 2016 ) ) . While many machine learning-based predictive models that capitalize on such data have been proposed over the past few years ( Jagannatha & Yu ( 2016 ) ; Choi et al . ( 2017 ) ; Alaa & van der Schaar ( 2019 ) ) , much less work has been done on generative models that could emulate and synthesize these data sets . Existing generative models for ( medical ) time-series are based predominantly on implicit likelihood modeling using generative adversarial networks ( GANs ) , e.g. , Recurrent Conditional GAN ( RCGAN ) ( Esteban et al . ( 2017 ) ) and TimeGAN ( Yoon et al . ( 2019 ) ) . These models apply representation learning via recurrent neural networks ( RNN ) combined with adversarial training in order to map noise sequences in a latent space to synthetic sequential data in the output space . Albeit capable of flexibly learning complex representations , GAN-based models can be difficult to train ( Srivastava et al . ( 2017 ) ) , especially in the complex time-series data setup . Moreover , because they hinge on implicit likelihood modeling , GAN-based models can be hard to evaluate quantitatively due to the absence of an explicitly computable likelihood function . Finally , GANs are vulnerable to training data memorization ( Nagarajan et al . ( 2018 ) ) —a problem that would be exacerbated in the temporal setting where memorizing only a partial segment of a medical time-series may suffice to reveal a patient ’ s identify , which defeats the original purpose of using synthetic data in the first place . Here , we propose an alternative explicit likelihood approach for generating time-series data based on a novel class of normalizing flows which we call Fourier flows . Our proposed flow-based model operates on time-series data in the frequency-domain rather than the time-domain—it converts variable-length time-series with varying sampling rates across different features to a fixed-size spectral representation using the discrete Fourier transform ( DFT ) , and then learns the distribution of the data in the frequency domain by applying a chain of data-dependent spectral filters to frequency-transformed time-series . Using the convolution property of DFT ( Oppenheim ( 1999 ) ) , we show that spectral filtering of a timeseries in the frequency-domain—an operation that mathematically resembles affine transformations used in existing flows ( Dinh et al . ( 2016 ) ) —is equivalent to a convolutional transformation in the timedomain . This enhancement in the richness of distributions learned by our flow comes at no extra computational cost : using Fast Fourier Transform ( FFT ) algorithms , we show that the entire steps of our flow run in O ( T log T ) time , compared to the polynomial complexity of O ( T 2 ) for a direct , time-domain convolutional transformation . We also show that , because the DFT is a linear transform with a Vandermonde transformation matrix , computation of its Jacobian determinant is trivial . The zero-padding and interpolation properties of DFT enables a natural handling of variable-length and inconsistently-sampled time-series . Unlike existing explicit-likelihood models for time-series data , such as deep state-space models ( Krishnan et al. , 2017 ; Alaa & van der Schaar , 2019 ) , our model can be optimized and assessed through the exact likelihood rather than a variational lower bound . 2 PROBLEM SETUP . We consider a general temporal data setup where each instance of a ( discrete ) time-series comprises a sequence of vectors x = [ x0 , . . . , xT−1 ] , xt ∈ X , ∀ 0 ≤ t ≤ T − 1 , covering a period of T time steps . We assume that each dimension in the feature vector xt is sampled with a different rate , i.e. , at each time step t , the observed feature vector is xt = [ xt,1 [ r1 ] , . . . , xt , D [ rD ] ] , where rd ∈ N+ is the sampling period of feature dimension d ∈ { 1 , . . . , D } . That is , for a given sampling period rd , we observe a value of xt , d every rd time steps , and observe a missing value ( denoted as * ) otherwise , i.e. , xt , d [ rd ] , { xt , d , t mod rd = 0 , ∗ , t mod rd 6= 0 . ( 1 ) The data setup described above is primarily motivated by medical time-series modeling problems , wherein a patient ’ s clinical measurements and bio-markers are collected over time at different rates ( Johnson et al . ( 2016 ) ; Jagannatha & Yu ( 2016 ) ) . Despite our focus on medical data , our proposed generative modeling approach applies more generally to other applications , such as speech synthesis ( Prenger et al . ( 2019 ) ) and financial data generation ( Wiese et al . ( 2020 ) ) . Each realization of the time-series x is drawn from a probability distribution x ∼ p ( x ) . In order to capture variable-length time-series ( common in medical problems ) , the length T of each sequence is also assumed to be a random variable—for notational convenience , we absorb the distribution of T into p. One possible way to represent the joint distribution p ( x ) is through the factorization:1 p ( x ) = p ( x0 , . . . , xT−1 , T ) = p ( T ) · T−1∏ t=0 p ( xt |x0 , . . . , xt−1 , T ) . ( 2 ) We assume that the sampling period rd for each feature d is fixed for all realizations of x . The feature space X is assumed to accommodate a mix of continuous and discrete variables on its D dimensions . 1Our proposed method is not restricted to any specific factorization of p ( x ) . Key objective . Using a training data set D = { x ( i ) } ni=1 comprising n time-series , our goal is to ( 1 ) estimate a density function p̂ ( x ) that best approximates p ( x ) , and ( 2 ) sample synthetic realizations of the time-series x from the estimated density p̂ ( x ) . When dealing with data sets with variable lengths for the time-series , we model the distribution p ( T ) independently following the factorization in ( 2 ) . We model p ( T ) using a binomial distribution . Throughout the paper , we focus on developing a flow-based model for the conditional distribution p ( x0 , . . . , xT−1 |T ) . 3 PRELIMINARIES . Let z ∈ RD be a random variable with a known and tractable probability density function p ( z ) , and let g : RD → RD be an invertible and differentiable mapping with an inverse mapping f = g−1 . Let x = g ( z ) be a transformed random variable—the probability density function p ( x ) can be obtained using the change of variable rule as p ( x ) = p ( z ) · | detJ [ g ] |−1 = p ( f ( x ) ) · | detJ [ f ] | , where J [ f ] and J [ g ] are the Jacobian matrices of functions f and g , respectively ( Durrett ( 2019 ) ) . Normalizing flows are compositions of M mappings that transform random draws from a predefined distribution z ∼ p ( z ) to a desired distribution p ( x ) . Formally , a flow comprises a chain of bijective maps g = g ( 1 ) ◦ g ( 2 ) ◦ · · · ◦ g ( M ) with an inverse mapping f = f ( 1 ) ◦ f ( 2 ) ◦ · · · ◦ f ( M ) . Using the change of variables formula described above , and applying the chain rule to the Jacobian of the composition , the log-likelihood of x can be written as ( Rezende & Mohamed ( 2015 ) ) : log p ( x ) = log p ( z ) + M∑ m=1 log |detJ [ fm ] | . ( 3 ) Existing approaches to generative modeling with normalizing flows construct composite mappings g with structural assumptions that render the computation of the Jacobian determinant in ( 3 ) viable . Examples of such structurally-constrained mappings include : Sylvester transformations , with a Jacobian corresponding to a perturbed diagonal matrix ( Rezende & Mohamed ( 2015 ) ) , 1× 1 convolutions for cross channel mixing , which exhibit a block diagonal Jacobian ( Kingma & Dhariwal ( 2018 ) ) , and affine coupling layers that correspond to triangular Jacobian matrices ( Dinh et al . ( 2016 ) ) . 3.1 FOURIER TRANSFORM . The Fourier transform is a mathematical operation that converts a finite-length , regularly-sampled time domain signal x to its frequency domain representationX ( Bracewell & Bracewell ( 1986 ) ) . A T -point discrete Fourier transform ( DFT ) , denoted asX = FT { x } , transforms a ( complex-valued ) time-stamped sequencex , { x0 , . . . , xT−1 } into a length-T sequence of ( complex-valued ) frequency components , X , { X0 , . . . , XT−1 } , through the following operation ( Oppenheim ( 1999 ) ) : Xk = T−1∑ t=0 xt · e−2πj· kt T , ∀1 ≤ k ≤ T − 1 , ( 4 ) where j corresponds to the imaginary unit of a split-complex number . Using Euler ’ s formula , the complex exponential terms in ( 4 ) can be expressed as e−2πj· kt T = cos ( 2π · ktT ) − j · sin ( 2π · ktT ) . Thus , the Fourier transform decomposes any time-series into a linear combination of sinusoidal signals of varying frequencies—the resulting sequence of frequency components , X , corresponds to the coefficients assigned to the different frequencies of the sinusoidal signals constituting the time domain signal x . The DFT is a key computational and conceptual tool in many practical applications involving digital signal processing and communications ( Oppenheim ( 1999 ) ) . 3.2 FOURIER TRANSFORM PROPERTIES . We will rely in developing our model on various key properties of the DFT . These properties describe various operations on the time-domain data and their dual ( equivalent ) operations in the frequency domain . The DFT properties relevant to the development of our model are listed as follows : Convolution : x1 ⊗ x2 ⇐⇒ X1 X2 . Symmetry : If x is real-valued⇒ Xk = X∗k−m , ∀m ∈ N. Even/Odd Transforms : F { Even ( x ) } = Re ( X ) , F { Odd ( x ) } = Im ( X ) , where denotes element-wise multiplication , ⊗ denotes circular convolution , Re ( . ) and Im ( . ) denote the real and imaginary components , Even ( x ) = ( x+ x− ) /2 , Odd ( x ) = ( x− x− ) /2 , where x− signifies the reflection of x with respect to the x = 0 axis , and x = Even ( x ) + Odd ( x ) . Another property that is relevant to our model is the interpolation property , which posits that zero-padding of x in the time domain corresponds to an up-sampled version ofX in the frequency domain .
The paper presents Fourier Flows (FF), which is a time series generative model in the frequency domain. It shows that the Jacobian of the DFT is equal to 1, which means that DFT does not add too much overhead. The results on the real-world datasets are encouraging and expected because the predictive results mainly rely on the overall trend of the time series. By analysis in the frequency domain, we usually can capture the main trend accurately. The main concerns for the paper are the computational overhead on the proposed algorithm on non-periodic, long, and variable-length time series.
SP:15f1f17659b0f5d0b5a71f32a3c1ca918d54cc3d
Generative Time-series Modeling with Fourier Flows
1 INTRODUCTION . Lack of access to data is a key hindrance to the development of machine learning solutions in application domains where data sharing may lead to privacy breaches ( Walonoski et al . ( 2018 ) ) . Areas where this problem is most conspicuous include medicine , where access to ( highly-sensitive ) clinical data is stringently regulated by medical institutions ; such strict regulations undermine scientific progress by hindering model development and reproducibility . Generative models that produce sensible and realistic synthetic data present a viable solution to this problem—artificially-generated data sets produced by such models can be shared widely without privacy concerns ( Buczak et al . ( 2010 ) ) . In this paper , we focus on the time-series data setup , where observations are collected sequentially over arbitrary periods of time with different observation frequencies across different features . This general data setup is pervasive in the medical domain—it captures the kind of data maintained in electronic health records ( Shickel et al . ( 2017 ) ) or collected in intensive care units ( Johnson et al . ( 2016 ) ) . While many machine learning-based predictive models that capitalize on such data have been proposed over the past few years ( Jagannatha & Yu ( 2016 ) ; Choi et al . ( 2017 ) ; Alaa & van der Schaar ( 2019 ) ) , much less work has been done on generative models that could emulate and synthesize these data sets . Existing generative models for ( medical ) time-series are based predominantly on implicit likelihood modeling using generative adversarial networks ( GANs ) , e.g. , Recurrent Conditional GAN ( RCGAN ) ( Esteban et al . ( 2017 ) ) and TimeGAN ( Yoon et al . ( 2019 ) ) . These models apply representation learning via recurrent neural networks ( RNN ) combined with adversarial training in order to map noise sequences in a latent space to synthetic sequential data in the output space . Albeit capable of flexibly learning complex representations , GAN-based models can be difficult to train ( Srivastava et al . ( 2017 ) ) , especially in the complex time-series data setup . Moreover , because they hinge on implicit likelihood modeling , GAN-based models can be hard to evaluate quantitatively due to the absence of an explicitly computable likelihood function . Finally , GANs are vulnerable to training data memorization ( Nagarajan et al . ( 2018 ) ) —a problem that would be exacerbated in the temporal setting where memorizing only a partial segment of a medical time-series may suffice to reveal a patient ’ s identify , which defeats the original purpose of using synthetic data in the first place . Here , we propose an alternative explicit likelihood approach for generating time-series data based on a novel class of normalizing flows which we call Fourier flows . Our proposed flow-based model operates on time-series data in the frequency-domain rather than the time-domain—it converts variable-length time-series with varying sampling rates across different features to a fixed-size spectral representation using the discrete Fourier transform ( DFT ) , and then learns the distribution of the data in the frequency domain by applying a chain of data-dependent spectral filters to frequency-transformed time-series . Using the convolution property of DFT ( Oppenheim ( 1999 ) ) , we show that spectral filtering of a timeseries in the frequency-domain—an operation that mathematically resembles affine transformations used in existing flows ( Dinh et al . ( 2016 ) ) —is equivalent to a convolutional transformation in the timedomain . This enhancement in the richness of distributions learned by our flow comes at no extra computational cost : using Fast Fourier Transform ( FFT ) algorithms , we show that the entire steps of our flow run in O ( T log T ) time , compared to the polynomial complexity of O ( T 2 ) for a direct , time-domain convolutional transformation . We also show that , because the DFT is a linear transform with a Vandermonde transformation matrix , computation of its Jacobian determinant is trivial . The zero-padding and interpolation properties of DFT enables a natural handling of variable-length and inconsistently-sampled time-series . Unlike existing explicit-likelihood models for time-series data , such as deep state-space models ( Krishnan et al. , 2017 ; Alaa & van der Schaar , 2019 ) , our model can be optimized and assessed through the exact likelihood rather than a variational lower bound . 2 PROBLEM SETUP . We consider a general temporal data setup where each instance of a ( discrete ) time-series comprises a sequence of vectors x = [ x0 , . . . , xT−1 ] , xt ∈ X , ∀ 0 ≤ t ≤ T − 1 , covering a period of T time steps . We assume that each dimension in the feature vector xt is sampled with a different rate , i.e. , at each time step t , the observed feature vector is xt = [ xt,1 [ r1 ] , . . . , xt , D [ rD ] ] , where rd ∈ N+ is the sampling period of feature dimension d ∈ { 1 , . . . , D } . That is , for a given sampling period rd , we observe a value of xt , d every rd time steps , and observe a missing value ( denoted as * ) otherwise , i.e. , xt , d [ rd ] , { xt , d , t mod rd = 0 , ∗ , t mod rd 6= 0 . ( 1 ) The data setup described above is primarily motivated by medical time-series modeling problems , wherein a patient ’ s clinical measurements and bio-markers are collected over time at different rates ( Johnson et al . ( 2016 ) ; Jagannatha & Yu ( 2016 ) ) . Despite our focus on medical data , our proposed generative modeling approach applies more generally to other applications , such as speech synthesis ( Prenger et al . ( 2019 ) ) and financial data generation ( Wiese et al . ( 2020 ) ) . Each realization of the time-series x is drawn from a probability distribution x ∼ p ( x ) . In order to capture variable-length time-series ( common in medical problems ) , the length T of each sequence is also assumed to be a random variable—for notational convenience , we absorb the distribution of T into p. One possible way to represent the joint distribution p ( x ) is through the factorization:1 p ( x ) = p ( x0 , . . . , xT−1 , T ) = p ( T ) · T−1∏ t=0 p ( xt |x0 , . . . , xt−1 , T ) . ( 2 ) We assume that the sampling period rd for each feature d is fixed for all realizations of x . The feature space X is assumed to accommodate a mix of continuous and discrete variables on its D dimensions . 1Our proposed method is not restricted to any specific factorization of p ( x ) . Key objective . Using a training data set D = { x ( i ) } ni=1 comprising n time-series , our goal is to ( 1 ) estimate a density function p̂ ( x ) that best approximates p ( x ) , and ( 2 ) sample synthetic realizations of the time-series x from the estimated density p̂ ( x ) . When dealing with data sets with variable lengths for the time-series , we model the distribution p ( T ) independently following the factorization in ( 2 ) . We model p ( T ) using a binomial distribution . Throughout the paper , we focus on developing a flow-based model for the conditional distribution p ( x0 , . . . , xT−1 |T ) . 3 PRELIMINARIES . Let z ∈ RD be a random variable with a known and tractable probability density function p ( z ) , and let g : RD → RD be an invertible and differentiable mapping with an inverse mapping f = g−1 . Let x = g ( z ) be a transformed random variable—the probability density function p ( x ) can be obtained using the change of variable rule as p ( x ) = p ( z ) · | detJ [ g ] |−1 = p ( f ( x ) ) · | detJ [ f ] | , where J [ f ] and J [ g ] are the Jacobian matrices of functions f and g , respectively ( Durrett ( 2019 ) ) . Normalizing flows are compositions of M mappings that transform random draws from a predefined distribution z ∼ p ( z ) to a desired distribution p ( x ) . Formally , a flow comprises a chain of bijective maps g = g ( 1 ) ◦ g ( 2 ) ◦ · · · ◦ g ( M ) with an inverse mapping f = f ( 1 ) ◦ f ( 2 ) ◦ · · · ◦ f ( M ) . Using the change of variables formula described above , and applying the chain rule to the Jacobian of the composition , the log-likelihood of x can be written as ( Rezende & Mohamed ( 2015 ) ) : log p ( x ) = log p ( z ) + M∑ m=1 log |detJ [ fm ] | . ( 3 ) Existing approaches to generative modeling with normalizing flows construct composite mappings g with structural assumptions that render the computation of the Jacobian determinant in ( 3 ) viable . Examples of such structurally-constrained mappings include : Sylvester transformations , with a Jacobian corresponding to a perturbed diagonal matrix ( Rezende & Mohamed ( 2015 ) ) , 1× 1 convolutions for cross channel mixing , which exhibit a block diagonal Jacobian ( Kingma & Dhariwal ( 2018 ) ) , and affine coupling layers that correspond to triangular Jacobian matrices ( Dinh et al . ( 2016 ) ) . 3.1 FOURIER TRANSFORM . The Fourier transform is a mathematical operation that converts a finite-length , regularly-sampled time domain signal x to its frequency domain representationX ( Bracewell & Bracewell ( 1986 ) ) . A T -point discrete Fourier transform ( DFT ) , denoted asX = FT { x } , transforms a ( complex-valued ) time-stamped sequencex , { x0 , . . . , xT−1 } into a length-T sequence of ( complex-valued ) frequency components , X , { X0 , . . . , XT−1 } , through the following operation ( Oppenheim ( 1999 ) ) : Xk = T−1∑ t=0 xt · e−2πj· kt T , ∀1 ≤ k ≤ T − 1 , ( 4 ) where j corresponds to the imaginary unit of a split-complex number . Using Euler ’ s formula , the complex exponential terms in ( 4 ) can be expressed as e−2πj· kt T = cos ( 2π · ktT ) − j · sin ( 2π · ktT ) . Thus , the Fourier transform decomposes any time-series into a linear combination of sinusoidal signals of varying frequencies—the resulting sequence of frequency components , X , corresponds to the coefficients assigned to the different frequencies of the sinusoidal signals constituting the time domain signal x . The DFT is a key computational and conceptual tool in many practical applications involving digital signal processing and communications ( Oppenheim ( 1999 ) ) . 3.2 FOURIER TRANSFORM PROPERTIES . We will rely in developing our model on various key properties of the DFT . These properties describe various operations on the time-domain data and their dual ( equivalent ) operations in the frequency domain . The DFT properties relevant to the development of our model are listed as follows : Convolution : x1 ⊗ x2 ⇐⇒ X1 X2 . Symmetry : If x is real-valued⇒ Xk = X∗k−m , ∀m ∈ N. Even/Odd Transforms : F { Even ( x ) } = Re ( X ) , F { Odd ( x ) } = Im ( X ) , where denotes element-wise multiplication , ⊗ denotes circular convolution , Re ( . ) and Im ( . ) denote the real and imaginary components , Even ( x ) = ( x+ x− ) /2 , Odd ( x ) = ( x− x− ) /2 , where x− signifies the reflection of x with respect to the x = 0 axis , and x = Even ( x ) + Odd ( x ) . Another property that is relevant to our model is the interpolation property , which posits that zero-padding of x in the time domain corresponds to an up-sampled version ofX in the frequency domain .
The paper introduces a new convolutional flow architecture that uses the DFT to convert the generated time series to the frequency domain. Convolutions are performed by multiplication in the frequency domain through a spectral affine layer that transform the even or odd part of the signal using a data dependent filter. The resulting time-domain convolution has input dependent weights, an interesting and original approach clearly different from other convolutional flow such as [1].
SP:15f1f17659b0f5d0b5a71f32a3c1ca918d54cc3d
The Traveling Observer Model: Multi-task Learning Through Spatial Variable Embeddings
1 INTRODUCTION . Natural organisms benefit from the fact that their sensory inputs and action outputs are all organized in the same space , that is , the physical universe . This consistency makes it easy to apply the same predictive functions across diverse settings . Deep multi-task learning ( Deep MTL ) has shown a similar ability to adapt knowledge across tasks whose observed variables are embedded in a shared space . Examples include vision , where the input for all tasks ( photograph , drawing , or otherwise ) is pixels arranged in a 2D plane ( Zhang et al. , 2014 ; Misra et al. , 2016 ; Rebuffi et al. , 2017 ) ; natural language ( Collobert & Weston , 2008 ; Luong et al. , 2016 ; Hashimoto et al. , 2017 ) , speech processing ( Seltzer & Droppo , 2013 ; Huang et al. , 2015 ) , and genomics ( Alipanahi et al. , 2015 ) , which exploit the 1D structure of text , waveforms , and nucleotide sequences ; and video game-playing ( Jaderberg et al. , 2017 ; Teh et al. , 2017 ) , where interactions are organized across space and time . Yet , many real-world prediction tasks have no such spatial organization ; their input and output variables are simply labeled values , e.g. , the height of a tree , the cost of a haircut , or the score on a standardized test . To make matters worse , these sets of variables are often disjoint across a set of tasks . These challenges have led the MTL community to avoid such tasks , despite the fact that general knowledge about how to make good predictions can arise from solving seemingly “ unrelated ” tasks ( Mahmud & Ray , 2008 ; Mahmud , 2009 ; Meyerson & Miikkulainen , 2019 ) . This paper proposes a solution : Learn all variable locations in a shared space , while simultaneously training the prediction model itself ( Figure 1 ) . To illustrate this idea , Figure 1a gives an example of four tasks whose variable values are measured at different locations in the same underlying 2D embedding space . The shape of each marker ( i.e. , ◦ , ,4 , ? ) denotes the task to which that variable belongs ; white markers denote input variable , black markers denote output variables , and the background coloring indicates the variable values in the entire embedding space when the current sample is drawn . As a concrete example , the color could indicate the air temperature at each point in a geographical region at a given moment in time , and each marker the location of a temperature sensor ( however , note that the embedding space is generally more abstract ) . Figure 1b-c shows a model that can be applied to any task in this universe , using the ◦ task as an example : ( b ) The function f encodes the value of each observed variable xi given its 2D location zi ∈ R2 , and these encodings are aggregated by elementwise addition ⊕ ; ( c ) The function g decodes the aggregated encoding to a prediction for yj at its location zj . Such a predictor can be viewed as a traveling observer model ( TOM ) : It traverses the space of variables , taking a measurement at the location of each input . Given these observations , the model can make a prediction for the value at the location of an output . In general , the embedded locations z are not known a priori ( i.e. , when input and output variables do not have obvious physical locations ) , but they can be learned alongside f and g by gradient descent . The input and output spaces of a prediction problem can be standardized so that the measured value of each input and output variable is a scalar . The prediction model can then be completely agnostic about the particular task for which it is making a prediction . By learning variable embeddings ( VEs ) , i.e. , the z ’ s , the model can capture variable relationships explicitly and supports joint training of a single architecture across seemingly unrelated tasks with disjoint input and output spaces . TOM thus establishes a new lower bound on the commonalities shared across real-world machine learning problems : They are all drawn from the same space of variables that humans can and do measure . This paper develops a first implementation of TOM , using an encoder-decoder architecture , with variable embeddings incorporated using FiLM ( Perez et al. , 2018 ) . In the experiments , the implementation is shown to ( 1 ) recover the intuitive locations of variables in space and time , ( 2 ) exploit regularities across related datasets with disjoint input and output spaces , and ( 3 ) exploit regularities across seemingly unrelated tasks to outperform single-tasks models tuned to each tasks , as well as current Deep MTL alternatives . The results confirm that TOM is a promising framework for representing and exploiting the underlying processes of seemingly unrelated tasks . 2 BACKGROUND : MULTI-TASK ENCODER-DECODER DECOMPOSITIONS . This section reviews Deep MTL methods from the perspective of decomposition into encoders and decoders ( Table 1 ) . In MTL , there are T tasks { ( xt , yt ) } Tt=1 that can , in general , be drawn from different domains and have varying input and output dimensionality . The tth task has nt input variables [ xt1 , . . . , xtnt ] = xt ∈ Rnt and mt output variables [ yt1 , . . . , ytmt ] = yt ∈ Rmt . Two tasks ( xt , yt ) and ( xt′ , yt′ ) are disjoint if their input and output variables are non-overlapping , i.e. , ( { xti } nti=1∪ { ytj } mt j=1 ) ∩ ( { xt′i } nt′i=1∪ { yt′j } mt′ j=1 ) = ∅ . The goal is to exploit regularities across task models xt 7→ ŷt by jointly training them with overlapping parameters . The standard intra-domain approach is for all task models to share their encoder f , and each to have its own task-specific decoder gt ( Table 1a ) . This setup was used in the original introduction of MTL ( Caruana , 1998 ) , has been broadly explored in the linear regime ( Argyriou et al. , 2008 ; Kang et al. , 2011 ; Kumar & Daumé , 2012 ) , and is the most common approach in Deep MTL ( Huang et al. , 2013 ; Zhang et al. , 2014 ; Dong et al. , 2015 ; Liu et al. , 2015 ; Ranjan et al. , 2016 ; Jaderberg et al. , 2017 ) . The main limitation of this approach is that it is limited to sets of tasks that are all drawn from the same domain . It also has the risk of the separate decoders doing so much of the learning that there is not much left to be shared , which is why the decoders are usually single affine layers . To address the issue of limited sharing , the task embeddings approach trains a single encoder f and single decoder g , with all task-specific parameters learned in embedding vectors zt that semantically characterize each task , and which are fed into the model as additional input ( Yang & Hospedales , 2014 ; Bilen & Vedaldi , 2017 ; Zintgraf et al. , 2019 ) ( Table 1b ) . Such methods require that all tasks have the same input and output space , but are flexible in how the embeddings can be used to adapt the model to each task . As a result , they can learn tighter connections between tasks than separate decoders , and these relationships can be analyzed by looking at the learned embeddings . To exploit regularities across tasks from diverse and disjoint domains , cross-domain methods have been introduced . Existing methods address the challenge of disjoint output and input spaces by using separate decoders and encoders for each domain ( Table 1c ) , and thus they require some other method of sharing model parameters across tasks , such as sharing some of their layers ( Kaiser et al. , 2017 ; Meyerson & Miikkulainen , 2018 ) or drawing their parameters from a shared pool ( Meyerson & Miikkulainen , 2019 ) . For many datasets , the separate encoder and decoder absorbs too much functionality to share optimally , and their complexity makes it difficult to analyze the relationships between tasks . Earlier work prior to deep learning showed that , from an algorithmic learning theory perspective , sharing knowledge across tasks should always be useful ( Mahmud & Ray , 2008 ; Mahmud , 2009 ) , but the accompanying experiments were limited to learning biases in a decision tree generation process , i.e. , the learned models themselves were not shared across tasks . TOM extends the notion of task embeddings to variable embeddings in order to apply the idea in the cross-domain setting ( Table 1d ) . The method is described in the next section . 3 THE TRAVELING OBSERVER MODEL . Consider the set of all scalar random variables that could possibly be measured { v1 , v2 , ... } = V . Each vi ∈ V could be an input or output variable for some prediction task . To characterize each vi semantically , associate with it a vector zi ∈ RC that encodes the meaning of vi , e.g. , “ height of left ear of human adult in inches ” , “ answer to survey question 9 on a scale of 1 to 5 ” , “ severity of heart disease ” , “ brightness of top-left pixel of photograph ” , etc . This vector zi is called the variable embedding ( VE ) of vi . Variable embeddings could be handcoded , e.g. , based on some featurization of the space of variables , but such a handcoding is usually unavailable , and would likely miss some of the underlying semantic regularities across variables . An alternative approach is to learn variable embeddings based on their utility in solving prediction problems of interest . A prediction task ( x , y ) = ( [ x1 , . . . , xn ] , [ y1 , . . . , ym ] ) is defined by its set of observed variables { xi } ni=1 ⊆ V and its set of target variables { yj } mj=1 ⊆ V whose values are unknown . The goal is to find a prediction function Ω that can be applied across any prediction task of interest , so that it can learn to exploit regularities across such problems . Let zi and zj be the variable embeddings corresponding to xi and yj , respectively . Then , this universal prediction model is of the form E [ yj | x ] = Ω ( x , { zi } ni=1 , zj ) . ( 1 ) Importantly , for any two tasks ( xt , yt ) , ( xt′ , yt′ ) , their prediction functions ( Eq . 1 ) differ only in their z ’ s , which enforces the constraint that functionality is otherwise completely shared across the models . One can view Ω as a traveling observer , who visits several locations in the C-dimensional variable space , takes measurements at those locations , and uses this information to make predictions of values at other locations . To make Ω concrete , it must be a function that can be applied to any number of variables , can fit any set of prediction problems , and is invariant to variable ordering , since we can not in general assume that a meaningful order exists . These requirements lead to the following decomposition : E [ yj | x ] = Ω ( x , { zi } ni=1 , zj ) = g ( n∑ i=1 f ( xi , zi ) , zj ) , ( 2 ) where f and g are functions called the encoder and decoder , with trainable parameters θf and θg , respectively . The variable embeddings z tell f and g which variables they are observing , and these z can be learned by gradient descent alongside θf and θg . A depiction of the model is shown in Figure 1 . For some integer M , f : RC+1 → RM and g : RM+C → R. In principle , f and g could be any sufficiently expressive functions of this form . A natural choice is to implement them as neural networks . They are called the encoder and decoder because they map variables to and from a latent space of sizeM . This model can then be trained end-to-end with gradient descent . A batch for gradient descent is constructed by sampling a prediction problem , e.g. , a task , from the distribution of problems of interest , and then sampling a batch of data from the data set for that problem . Notice that , in addition to supervised training , in this framework it is natural to autoencode , i.e. , predict input variables , and subsample inputs to simulate multiple tasks drawn from the same universe . The question remains : How can f and g be designed so that they can sufficiently capture a broad range of prediction behavior , and be effectively conditioned by variable embeddings ? The next section introduces an experimental architecture that satisfies these requirements .
.** Authors present a methodology for performing multi-task learning from data with disjoint and heterogeneous input domains. Particularly, they introduce an embedding of the inputs, in order to project each pair of input-output observations in a common continuous manifold where the exploration is significantly easier. Results show that the approach is valid with both synthetic and real-world data and they also demonstrate that the model is flexible when increasing/decreasing the dimensionality of the latent manifold.
SP:b97073d441c824891124ad65fd95937fe9e53533
The Traveling Observer Model: Multi-task Learning Through Spatial Variable Embeddings
1 INTRODUCTION . Natural organisms benefit from the fact that their sensory inputs and action outputs are all organized in the same space , that is , the physical universe . This consistency makes it easy to apply the same predictive functions across diverse settings . Deep multi-task learning ( Deep MTL ) has shown a similar ability to adapt knowledge across tasks whose observed variables are embedded in a shared space . Examples include vision , where the input for all tasks ( photograph , drawing , or otherwise ) is pixels arranged in a 2D plane ( Zhang et al. , 2014 ; Misra et al. , 2016 ; Rebuffi et al. , 2017 ) ; natural language ( Collobert & Weston , 2008 ; Luong et al. , 2016 ; Hashimoto et al. , 2017 ) , speech processing ( Seltzer & Droppo , 2013 ; Huang et al. , 2015 ) , and genomics ( Alipanahi et al. , 2015 ) , which exploit the 1D structure of text , waveforms , and nucleotide sequences ; and video game-playing ( Jaderberg et al. , 2017 ; Teh et al. , 2017 ) , where interactions are organized across space and time . Yet , many real-world prediction tasks have no such spatial organization ; their input and output variables are simply labeled values , e.g. , the height of a tree , the cost of a haircut , or the score on a standardized test . To make matters worse , these sets of variables are often disjoint across a set of tasks . These challenges have led the MTL community to avoid such tasks , despite the fact that general knowledge about how to make good predictions can arise from solving seemingly “ unrelated ” tasks ( Mahmud & Ray , 2008 ; Mahmud , 2009 ; Meyerson & Miikkulainen , 2019 ) . This paper proposes a solution : Learn all variable locations in a shared space , while simultaneously training the prediction model itself ( Figure 1 ) . To illustrate this idea , Figure 1a gives an example of four tasks whose variable values are measured at different locations in the same underlying 2D embedding space . The shape of each marker ( i.e. , ◦ , ,4 , ? ) denotes the task to which that variable belongs ; white markers denote input variable , black markers denote output variables , and the background coloring indicates the variable values in the entire embedding space when the current sample is drawn . As a concrete example , the color could indicate the air temperature at each point in a geographical region at a given moment in time , and each marker the location of a temperature sensor ( however , note that the embedding space is generally more abstract ) . Figure 1b-c shows a model that can be applied to any task in this universe , using the ◦ task as an example : ( b ) The function f encodes the value of each observed variable xi given its 2D location zi ∈ R2 , and these encodings are aggregated by elementwise addition ⊕ ; ( c ) The function g decodes the aggregated encoding to a prediction for yj at its location zj . Such a predictor can be viewed as a traveling observer model ( TOM ) : It traverses the space of variables , taking a measurement at the location of each input . Given these observations , the model can make a prediction for the value at the location of an output . In general , the embedded locations z are not known a priori ( i.e. , when input and output variables do not have obvious physical locations ) , but they can be learned alongside f and g by gradient descent . The input and output spaces of a prediction problem can be standardized so that the measured value of each input and output variable is a scalar . The prediction model can then be completely agnostic about the particular task for which it is making a prediction . By learning variable embeddings ( VEs ) , i.e. , the z ’ s , the model can capture variable relationships explicitly and supports joint training of a single architecture across seemingly unrelated tasks with disjoint input and output spaces . TOM thus establishes a new lower bound on the commonalities shared across real-world machine learning problems : They are all drawn from the same space of variables that humans can and do measure . This paper develops a first implementation of TOM , using an encoder-decoder architecture , with variable embeddings incorporated using FiLM ( Perez et al. , 2018 ) . In the experiments , the implementation is shown to ( 1 ) recover the intuitive locations of variables in space and time , ( 2 ) exploit regularities across related datasets with disjoint input and output spaces , and ( 3 ) exploit regularities across seemingly unrelated tasks to outperform single-tasks models tuned to each tasks , as well as current Deep MTL alternatives . The results confirm that TOM is a promising framework for representing and exploiting the underlying processes of seemingly unrelated tasks . 2 BACKGROUND : MULTI-TASK ENCODER-DECODER DECOMPOSITIONS . This section reviews Deep MTL methods from the perspective of decomposition into encoders and decoders ( Table 1 ) . In MTL , there are T tasks { ( xt , yt ) } Tt=1 that can , in general , be drawn from different domains and have varying input and output dimensionality . The tth task has nt input variables [ xt1 , . . . , xtnt ] = xt ∈ Rnt and mt output variables [ yt1 , . . . , ytmt ] = yt ∈ Rmt . Two tasks ( xt , yt ) and ( xt′ , yt′ ) are disjoint if their input and output variables are non-overlapping , i.e. , ( { xti } nti=1∪ { ytj } mt j=1 ) ∩ ( { xt′i } nt′i=1∪ { yt′j } mt′ j=1 ) = ∅ . The goal is to exploit regularities across task models xt 7→ ŷt by jointly training them with overlapping parameters . The standard intra-domain approach is for all task models to share their encoder f , and each to have its own task-specific decoder gt ( Table 1a ) . This setup was used in the original introduction of MTL ( Caruana , 1998 ) , has been broadly explored in the linear regime ( Argyriou et al. , 2008 ; Kang et al. , 2011 ; Kumar & Daumé , 2012 ) , and is the most common approach in Deep MTL ( Huang et al. , 2013 ; Zhang et al. , 2014 ; Dong et al. , 2015 ; Liu et al. , 2015 ; Ranjan et al. , 2016 ; Jaderberg et al. , 2017 ) . The main limitation of this approach is that it is limited to sets of tasks that are all drawn from the same domain . It also has the risk of the separate decoders doing so much of the learning that there is not much left to be shared , which is why the decoders are usually single affine layers . To address the issue of limited sharing , the task embeddings approach trains a single encoder f and single decoder g , with all task-specific parameters learned in embedding vectors zt that semantically characterize each task , and which are fed into the model as additional input ( Yang & Hospedales , 2014 ; Bilen & Vedaldi , 2017 ; Zintgraf et al. , 2019 ) ( Table 1b ) . Such methods require that all tasks have the same input and output space , but are flexible in how the embeddings can be used to adapt the model to each task . As a result , they can learn tighter connections between tasks than separate decoders , and these relationships can be analyzed by looking at the learned embeddings . To exploit regularities across tasks from diverse and disjoint domains , cross-domain methods have been introduced . Existing methods address the challenge of disjoint output and input spaces by using separate decoders and encoders for each domain ( Table 1c ) , and thus they require some other method of sharing model parameters across tasks , such as sharing some of their layers ( Kaiser et al. , 2017 ; Meyerson & Miikkulainen , 2018 ) or drawing their parameters from a shared pool ( Meyerson & Miikkulainen , 2019 ) . For many datasets , the separate encoder and decoder absorbs too much functionality to share optimally , and their complexity makes it difficult to analyze the relationships between tasks . Earlier work prior to deep learning showed that , from an algorithmic learning theory perspective , sharing knowledge across tasks should always be useful ( Mahmud & Ray , 2008 ; Mahmud , 2009 ) , but the accompanying experiments were limited to learning biases in a decision tree generation process , i.e. , the learned models themselves were not shared across tasks . TOM extends the notion of task embeddings to variable embeddings in order to apply the idea in the cross-domain setting ( Table 1d ) . The method is described in the next section . 3 THE TRAVELING OBSERVER MODEL . Consider the set of all scalar random variables that could possibly be measured { v1 , v2 , ... } = V . Each vi ∈ V could be an input or output variable for some prediction task . To characterize each vi semantically , associate with it a vector zi ∈ RC that encodes the meaning of vi , e.g. , “ height of left ear of human adult in inches ” , “ answer to survey question 9 on a scale of 1 to 5 ” , “ severity of heart disease ” , “ brightness of top-left pixel of photograph ” , etc . This vector zi is called the variable embedding ( VE ) of vi . Variable embeddings could be handcoded , e.g. , based on some featurization of the space of variables , but such a handcoding is usually unavailable , and would likely miss some of the underlying semantic regularities across variables . An alternative approach is to learn variable embeddings based on their utility in solving prediction problems of interest . A prediction task ( x , y ) = ( [ x1 , . . . , xn ] , [ y1 , . . . , ym ] ) is defined by its set of observed variables { xi } ni=1 ⊆ V and its set of target variables { yj } mj=1 ⊆ V whose values are unknown . The goal is to find a prediction function Ω that can be applied across any prediction task of interest , so that it can learn to exploit regularities across such problems . Let zi and zj be the variable embeddings corresponding to xi and yj , respectively . Then , this universal prediction model is of the form E [ yj | x ] = Ω ( x , { zi } ni=1 , zj ) . ( 1 ) Importantly , for any two tasks ( xt , yt ) , ( xt′ , yt′ ) , their prediction functions ( Eq . 1 ) differ only in their z ’ s , which enforces the constraint that functionality is otherwise completely shared across the models . One can view Ω as a traveling observer , who visits several locations in the C-dimensional variable space , takes measurements at those locations , and uses this information to make predictions of values at other locations . To make Ω concrete , it must be a function that can be applied to any number of variables , can fit any set of prediction problems , and is invariant to variable ordering , since we can not in general assume that a meaningful order exists . These requirements lead to the following decomposition : E [ yj | x ] = Ω ( x , { zi } ni=1 , zj ) = g ( n∑ i=1 f ( xi , zi ) , zj ) , ( 2 ) where f and g are functions called the encoder and decoder , with trainable parameters θf and θg , respectively . The variable embeddings z tell f and g which variables they are observing , and these z can be learned by gradient descent alongside θf and θg . A depiction of the model is shown in Figure 1 . For some integer M , f : RC+1 → RM and g : RM+C → R. In principle , f and g could be any sufficiently expressive functions of this form . A natural choice is to implement them as neural networks . They are called the encoder and decoder because they map variables to and from a latent space of sizeM . This model can then be trained end-to-end with gradient descent . A batch for gradient descent is constructed by sampling a prediction problem , e.g. , a task , from the distribution of problems of interest , and then sampling a batch of data from the data set for that problem . Notice that , in addition to supervised training , in this framework it is natural to autoencode , i.e. , predict input variables , and subsample inputs to simulate multiple tasks drawn from the same universe . The question remains : How can f and g be designed so that they can sufficiently capture a broad range of prediction behavior , and be effectively conditioned by variable embeddings ? The next section introduces an experimental architecture that satisfies these requirements .
This paper presents the traveling observer model (TOM), a general framework to learn multiple heterogenous supervized (input,output) tasks, which are indexed by a continuous "variable embedding" that is automatically learned by the system. The authors show on simple problems that the learned task embeddings can recover an intuitive organization of the problems' variables in space or time. They also show that the model simultaneously trained on 121 seemingly unrelated classification tasks can outperform state-of-the art supervized methods fine-tuned on single tasks.
SP:b97073d441c824891124ad65fd95937fe9e53533
AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights
1 INTRODUCTION . Normalization techniques , such as batch normalization ( BN ) ( Ioffe & Szegedy , 2015 ) , layer normalization ( LN ) ( Ba et al. , 2016 ) , instance normalization ( IN ) ( Ulyanov et al. , 2016 ) , and group normalization ( GN ) ( Wu & He , 2018 ) , have become standard tools for training deep neural network models . Originally proposed to reduce the internal covariate shift ( Ioffe & Szegedy , 2015 ) , normalization methods have proven to encourage several desirable properties in deep neural networks , such as better generalization ( Santurkar et al. , 2018 ) and the scale invariance ( Hoffer et al. , 2018 ) . Prior studies have observed that the normalization-induced scale invariance of weights stabilizes the convergence for the neural network training ( Hoffer et al. , 2018 ; Arora et al. , 2019 ; Kohler et al. , 2019 ; Dukler et al. , 2020 ) . We provide a sketch of the argument here . Given weights w and an input x , we observe that the normalization makes the weights become scale-invariant : Norm ( w > x ) = Norm ( cw > x ) ∀c > 0 . ( 1 ) The resulting equivalence relation among the weights lets us consider the weights only in terms of their ` 2-normalized vectors ŵ : = w‖w‖2 on the sphere S d−1 = { v ∈ Rd : ‖v‖2 = 1 } . We refer to Sd−1 as the effective space , as opposed to the nominal space Rd where the actual optimization algorithms operate . The mismatch between these spaces results in the discrepancy between the gradient descent steps on Rd and their effective steps on Sd−1 . Specifically , for the gradient descent updates , the effective step sizes ‖∆ŵt+1‖2 : = ‖ŵt+1 − ŵt‖2 are the scaled versions of the nominal step sizes ‖∆wt+1‖2 : = ‖wt+1−wt‖2 by the factor 1‖wt‖2 ( Hoffer et al. , 2018 ) . Since ‖wt‖2 increases during training ( Soudry et al. , 2018 ; Arora et al. , 2019 ) , the effective step sizes ‖∆ŵt‖2 decrease as the optimization progresses . The automatic decrease in step sizes stabilizes the convergence of gradient descent algorithms applied on models with normalization layers : even if the nominal learning rate is set to a constant , the theoretically optimal convergence rate is guaranteed ( Arora et al. , 2019 ) . maxw w > w ? ‖w‖2‖w ? ‖2 s. Trajectories start from w0 towards the optimal solution w ? . The problem is invariant to the scale of w. Video version in the attached code . In this work , we show that the widely used momentum-based gradient descent optimizers ( e.g . SGD and Adam ( Kingma & Ba , 2015 ) ) decreases the effective step size ∆ŵt even more rapidly than the momentum-less counterparts considered in ( Arora et al. , 2019 ) . This leads to a slower effective convergence for ŵt and potentially sub-optimal model performances . We illustrate this effect on a 2D toy optimization problem in Figure 1 . Compared to “ GD ” , “ GD+momentum ” is much faster in the nominal space R2 , but the norm growth slows down the effective convergence in S1 , reducing the acceleration effect of momentum . This phenomenon is not confined to the toy setup , for example , 95.5 % and 91.8 % of the parameters of the widely-used ResNet18 and ResNet50 ( He et al. , 2016 ) are scale-invariant due to BN . The majority of deep models nowadays are trained with SGD or Adam with momentum . And yet , our paper is first to delve into the issue in the widely-used combination of scale-invariant parameters and momentum-based optimizers . We propose a simple solution to slow down the decay of effective step sizes while maintaining the step directions of the original optimizer in the effective space . At each iteration of a momentum-based gradient descent optimizer , we propose to project out the radial component ( i.e . component parallel to w ) from the update , thereby reducing the increase in the weight norm over time . Because of the scale invariance , the procedure does not alter the update direction in the effective space ; it only changes the effective step sizes . We can observe the benefit of our optimizer in the toy setting in Figure 1 . “ Ours ” suppresses the norm growth and thus slows down the effective learning rate decay , allowing the momentum-accelerated convergence in R2 to be transferred to the actual space S1 . “ Ours ” converges most quickly and achieves the best terminal objective value . We do not discourage the use of momentum-based optimizers ; momentum is often an indispensable ingredient that enables best performances by deep neural networks . Instead , we propose to use our method that helps momentum realize its full potential by letting the acceleration operate on the effective space , rather than squandering it on increasing norms to no avail . The projection algorithm is simple and readily applicable to various optimizers for deep neural networks . We apply this technique on SGD and Adam ( SGDP and AdamP , respectively ) and verify the slower decay of effective learning rates as well as the resulting performance boosts over a diverse set of practical machine learning tasks including image classification , image retrieval , object detection , robustness benchmarks , audio classification , and language modelling . As a side note , we have identified certain similarities between our approaches and Cho & Lee ( 2017 ) . Cho & Lee ( 2017 ) have considered performing the optimization steps for the scale-invariant parameters on the spherical manifold . We argue that our approaches are conceptually different , as ours operate on the ambient Euclidean space , and are more practical . See Appendix §G.1 for a more detailed argumentation based on conceptual and empirical comparisons . 2 PROBLEM . Widely-used normalization techniques ( Ioffe & Szegedy , 2015 ; Salimans & Kingma , 2016 ; Ba et al. , 2016 ; Ulyanov et al. , 2016 ; Wu & He , 2018 ) in deep networks result in the scale invariance for weights . We show that the introduction of momentum in gradient-descent ( GD ) optimizers , when applied on such scale-invariant parameters , decreases the effective learning rate much more rapidly . This phenomenon has not yet been studied in literature , despite its ubiquity . We suspect the resulting early convergence may have introduced sub-optimality in many SGD and Adam-trained models across machine learning tasks . The analysis motivates our optimizer in §3 . 2.1 NORMALIZATION LAYER AND SCALE INVARIANCE . For a tensor x ∈ Rn1×···×nr of rank r , we define the normalization operation along the axes k ∈ { 0 , 1 } { 1 , ··· , r } as Normk ( x ) = x−µk ( x ) σk ( x ) where µk , σk are the mean and standard deviation functions along the axes k , without axes reduction ( to allow broadcasted operations with x ) . Depending on k , Normk includes special cases like batch normalization ( BN ) ( Ioffe & Szegedy , 2015 ) . For a function g ( u ) , we say that g is scale invariant if g ( cu ) = g ( u ) for any c > 0 . We then observe that Norm ( · ) is scale invariant . In particular , under the context of neural networks , Norm ( w > x ) = Norm ( ( cw ) > x ) ( 2 ) for any c > 0 , leading to the scale invariance against the weights w preceding the normalization layer . The norm of such weights ‖w‖2 does not affect the forward fw ( x ) or the backward ∇wfw ( x ) computations of a neural network layer fw parameterized by w. We may represent the scale-invariant weights via their ` 2-normalized vectors ŵ : = w‖w‖2 ∈ S d−1 ( i.e . c = 1‖w‖2 ) . 2.2 NOTATIONS FOR THE OPTIMIZATION STEPS −ηpt ŵt+1ŵt wt+1 wt ‖∆w t+ 1‖2 ‖∆ŵt+1‖2 See the illustration on the right for the summary of notations describing an optimization step . We write a gradient descent ( GD ) algorithm as : wt+1 ← wt − ηpt ( 3 ) where η > 0 is the user-defined learning rate . The norm of the difference ‖∆wt+1‖2 : = ‖wt+1 − wt‖2 = η‖pt‖2 is referred to as the step size . When p = ∇wf ( w ) , equation 3 is the vanilla GD algorithm . Momentumbased variants have more complex forms for p. In this work , we study the optimization problem in terms of the ` 2 normalized weights in Sd−1 , as opposed to the nominal space Rd . As the result of equation 3 , an effective optimization step takes place in Sd−1 : ∆ŵt+1 : = ŵt+1 − ŵt . We refer to the effective step size ‖∆ŵt+1‖2 . 2.3 EFFECTIVE STEP SIZES FOR VANILLA GRADIENT DESCENT ( GD ) . We approximate the effective step sizes for the scale-invariant w under the vanilla GD algorithm . We observe that the scale invariance f ( cw ) ≡ f ( w ) leads to the orthogonality : 0 = ∂f ( cw ) ∂c = w > ∇wf ( w ) . ( 4 ) For example , the vanilla GD update step p = ∇wf ( w ) is always perpendicular to w. Based on this , we establish the effective step size for w on Sd−1 : ‖∆ŵt+1‖2 : = ∥∥∥∥ wt+1 ‖wt+1‖2 − wt‖wt‖2 ∥∥∥∥ 2 ≈ ∥∥∥∥ wt+1 ‖wt+1‖2 − wt‖wt+1‖2 ∥∥∥∥ 2 = ‖∆wt+1‖2 ‖wt+1‖2 ( 5 ) where the approximation assumes 1‖wt+1‖2 − 1 ‖wt‖2 = o ( η ) , which holds when pt ⊥ wt as in the vanilla GD . We have thus derived that the effective step size on Sd−1 is inversely proportional to the weight norm , in line with the results in Hoffer et al . ( 2018 ) . Having established the relationship between the effective step sizes and the weight norm of a scaleinvariant parameters ( s.i.p ) , we derive the formula for its growth under the vanilla GD optimization . Lemma 2.1 ( Norm growth by GD , Lemma 2.4 in Arora et al . ( 2019 ) ) . For a s.i.p . w and the vanilla GD , where pt = ∇wf ( wt ) , ‖wt+1‖22 = ‖wt‖22 + η2‖pt‖22 . ( 6 ) The lemma follows from the orthogonality in equation 4 . It follows that the norm of a scale-invariant parameter ‖w‖2 is monotonically increasing and consequently decreases the effective step size for w. Arora et al . ( 2019 ) has further shown that GD with the above adaptive step sizes converges to a stationary point at the theoretically optimal convergence rate O ( T−1/2 ) under a fixed learning rate . 2.4 RAPID DECAY OF EFFECTIVE STEP SIZES FOR MOMENTUM-BASED GD . Momentum is designed to accelerate the convergence of gradient-based optimization by letting w escape high-curvature regions and cope with small and noisy gradients . It has become an indispensable ingredient for training modern deep neural networks . A momentum update follows : wt+1 ← wt − ηpt , pt ← βpt−1 +∇wtf ( wt ) ( 7 ) for steps t ≥ 0 , where β ∈ ( 0 , 1 ) and p−1 is initialized at 0 . Note that the step direction pt and the parameter wt may not be perpendicular anymore . We show below that momentum increases the weight norm under the scale invariance , even more so than does the vanilla GD . Lemma 2.2 ( Norm growth by momentum ) . For a s.i.p . w updated via equation 7 , we have ‖wt+1‖22 = ‖wt‖22 + η2‖pt‖22 + 2η2 t−1∑ k=0 βt−k‖pk‖22 . ( 8 ) Proof is in the Appendix §A . Comparing Lemma 2.1 and 2.2 , we notice that the formulation is identical , except for the last term on the right hand side of Lemma 2.2 . This term is not only non-negative , but also is an accumulation of the past updates . This additional term results in the significantly accelerated increase of weight norms when the momentum is used . We derive a more precise asymptotic ratio of the weight norms for the GD with and without momentum below . Corollary 2.3 ( Asymptotic norm growth comparison ) . Let ‖wGDt ‖2 and ‖wGDMt ‖2 be the weight norms at step t ≥ 0 , following the recursive formula in Lemma 2.1 and 2.2 , respectively . We assume that the norms of the updates ‖pt‖2 for GD with and without momentum are identical for every t ≥ 0 . We further assume that the sum of the update norms is non-zero and bounded : 0 < ∑ t≥0 ‖pt‖22 < ∞ . Then , the asymptotic ratio between the two norms is given by : ‖wGDMt ‖22 − ‖w0‖22 ‖wGDt ‖22 − ‖w0‖22 −→ 1 + 2β 1− β as t→∞ . ( 9 ) Proof in the Appendix §A . While the identity assumption for ‖pt‖2 between GD with and without momentum is strong , the theory is designed to illustrate an approximate norm growth ratios between the algorithms . For a popular choice of β = 0.9 , the factor is as high as 1 + 2β/ ( 1− β ) = 19 . Our observations are also applicable to Nesterov momentum and momentum-based adaptive optimizers like Adam . We later verify that the momentum induce the increase in weight norms and thus rapidly reduces the effective learning rates in many realistic setups of practical relevance ( §3.2 and §4 ) .
This paper shows that momentum-based gradient descent optimizers reduce the effective step size in training scale-invariant models including deep neural networks normalized by batch normalization, layer normaliztion, instance normalization and group normalization. The authors then propose a solution that projects the update at each step in gradient descent onto the tangent space of the model parameters. Theoretical results are provided to show that this projection operator only adjusts the effective learning rate but does not change the effective update directions. Empirical results on various tasks are provided to justify the advantage of the proposed method over the baseline momentum-based (stochastic) gradient descent and Adam.
SP:4e2ac2684ed817d9221154e922dabd54ff51fc90
AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights
1 INTRODUCTION . Normalization techniques , such as batch normalization ( BN ) ( Ioffe & Szegedy , 2015 ) , layer normalization ( LN ) ( Ba et al. , 2016 ) , instance normalization ( IN ) ( Ulyanov et al. , 2016 ) , and group normalization ( GN ) ( Wu & He , 2018 ) , have become standard tools for training deep neural network models . Originally proposed to reduce the internal covariate shift ( Ioffe & Szegedy , 2015 ) , normalization methods have proven to encourage several desirable properties in deep neural networks , such as better generalization ( Santurkar et al. , 2018 ) and the scale invariance ( Hoffer et al. , 2018 ) . Prior studies have observed that the normalization-induced scale invariance of weights stabilizes the convergence for the neural network training ( Hoffer et al. , 2018 ; Arora et al. , 2019 ; Kohler et al. , 2019 ; Dukler et al. , 2020 ) . We provide a sketch of the argument here . Given weights w and an input x , we observe that the normalization makes the weights become scale-invariant : Norm ( w > x ) = Norm ( cw > x ) ∀c > 0 . ( 1 ) The resulting equivalence relation among the weights lets us consider the weights only in terms of their ` 2-normalized vectors ŵ : = w‖w‖2 on the sphere S d−1 = { v ∈ Rd : ‖v‖2 = 1 } . We refer to Sd−1 as the effective space , as opposed to the nominal space Rd where the actual optimization algorithms operate . The mismatch between these spaces results in the discrepancy between the gradient descent steps on Rd and their effective steps on Sd−1 . Specifically , for the gradient descent updates , the effective step sizes ‖∆ŵt+1‖2 : = ‖ŵt+1 − ŵt‖2 are the scaled versions of the nominal step sizes ‖∆wt+1‖2 : = ‖wt+1−wt‖2 by the factor 1‖wt‖2 ( Hoffer et al. , 2018 ) . Since ‖wt‖2 increases during training ( Soudry et al. , 2018 ; Arora et al. , 2019 ) , the effective step sizes ‖∆ŵt‖2 decrease as the optimization progresses . The automatic decrease in step sizes stabilizes the convergence of gradient descent algorithms applied on models with normalization layers : even if the nominal learning rate is set to a constant , the theoretically optimal convergence rate is guaranteed ( Arora et al. , 2019 ) . maxw w > w ? ‖w‖2‖w ? ‖2 s. Trajectories start from w0 towards the optimal solution w ? . The problem is invariant to the scale of w. Video version in the attached code . In this work , we show that the widely used momentum-based gradient descent optimizers ( e.g . SGD and Adam ( Kingma & Ba , 2015 ) ) decreases the effective step size ∆ŵt even more rapidly than the momentum-less counterparts considered in ( Arora et al. , 2019 ) . This leads to a slower effective convergence for ŵt and potentially sub-optimal model performances . We illustrate this effect on a 2D toy optimization problem in Figure 1 . Compared to “ GD ” , “ GD+momentum ” is much faster in the nominal space R2 , but the norm growth slows down the effective convergence in S1 , reducing the acceleration effect of momentum . This phenomenon is not confined to the toy setup , for example , 95.5 % and 91.8 % of the parameters of the widely-used ResNet18 and ResNet50 ( He et al. , 2016 ) are scale-invariant due to BN . The majority of deep models nowadays are trained with SGD or Adam with momentum . And yet , our paper is first to delve into the issue in the widely-used combination of scale-invariant parameters and momentum-based optimizers . We propose a simple solution to slow down the decay of effective step sizes while maintaining the step directions of the original optimizer in the effective space . At each iteration of a momentum-based gradient descent optimizer , we propose to project out the radial component ( i.e . component parallel to w ) from the update , thereby reducing the increase in the weight norm over time . Because of the scale invariance , the procedure does not alter the update direction in the effective space ; it only changes the effective step sizes . We can observe the benefit of our optimizer in the toy setting in Figure 1 . “ Ours ” suppresses the norm growth and thus slows down the effective learning rate decay , allowing the momentum-accelerated convergence in R2 to be transferred to the actual space S1 . “ Ours ” converges most quickly and achieves the best terminal objective value . We do not discourage the use of momentum-based optimizers ; momentum is often an indispensable ingredient that enables best performances by deep neural networks . Instead , we propose to use our method that helps momentum realize its full potential by letting the acceleration operate on the effective space , rather than squandering it on increasing norms to no avail . The projection algorithm is simple and readily applicable to various optimizers for deep neural networks . We apply this technique on SGD and Adam ( SGDP and AdamP , respectively ) and verify the slower decay of effective learning rates as well as the resulting performance boosts over a diverse set of practical machine learning tasks including image classification , image retrieval , object detection , robustness benchmarks , audio classification , and language modelling . As a side note , we have identified certain similarities between our approaches and Cho & Lee ( 2017 ) . Cho & Lee ( 2017 ) have considered performing the optimization steps for the scale-invariant parameters on the spherical manifold . We argue that our approaches are conceptually different , as ours operate on the ambient Euclidean space , and are more practical . See Appendix §G.1 for a more detailed argumentation based on conceptual and empirical comparisons . 2 PROBLEM . Widely-used normalization techniques ( Ioffe & Szegedy , 2015 ; Salimans & Kingma , 2016 ; Ba et al. , 2016 ; Ulyanov et al. , 2016 ; Wu & He , 2018 ) in deep networks result in the scale invariance for weights . We show that the introduction of momentum in gradient-descent ( GD ) optimizers , when applied on such scale-invariant parameters , decreases the effective learning rate much more rapidly . This phenomenon has not yet been studied in literature , despite its ubiquity . We suspect the resulting early convergence may have introduced sub-optimality in many SGD and Adam-trained models across machine learning tasks . The analysis motivates our optimizer in §3 . 2.1 NORMALIZATION LAYER AND SCALE INVARIANCE . For a tensor x ∈ Rn1×···×nr of rank r , we define the normalization operation along the axes k ∈ { 0 , 1 } { 1 , ··· , r } as Normk ( x ) = x−µk ( x ) σk ( x ) where µk , σk are the mean and standard deviation functions along the axes k , without axes reduction ( to allow broadcasted operations with x ) . Depending on k , Normk includes special cases like batch normalization ( BN ) ( Ioffe & Szegedy , 2015 ) . For a function g ( u ) , we say that g is scale invariant if g ( cu ) = g ( u ) for any c > 0 . We then observe that Norm ( · ) is scale invariant . In particular , under the context of neural networks , Norm ( w > x ) = Norm ( ( cw ) > x ) ( 2 ) for any c > 0 , leading to the scale invariance against the weights w preceding the normalization layer . The norm of such weights ‖w‖2 does not affect the forward fw ( x ) or the backward ∇wfw ( x ) computations of a neural network layer fw parameterized by w. We may represent the scale-invariant weights via their ` 2-normalized vectors ŵ : = w‖w‖2 ∈ S d−1 ( i.e . c = 1‖w‖2 ) . 2.2 NOTATIONS FOR THE OPTIMIZATION STEPS −ηpt ŵt+1ŵt wt+1 wt ‖∆w t+ 1‖2 ‖∆ŵt+1‖2 See the illustration on the right for the summary of notations describing an optimization step . We write a gradient descent ( GD ) algorithm as : wt+1 ← wt − ηpt ( 3 ) where η > 0 is the user-defined learning rate . The norm of the difference ‖∆wt+1‖2 : = ‖wt+1 − wt‖2 = η‖pt‖2 is referred to as the step size . When p = ∇wf ( w ) , equation 3 is the vanilla GD algorithm . Momentumbased variants have more complex forms for p. In this work , we study the optimization problem in terms of the ` 2 normalized weights in Sd−1 , as opposed to the nominal space Rd . As the result of equation 3 , an effective optimization step takes place in Sd−1 : ∆ŵt+1 : = ŵt+1 − ŵt . We refer to the effective step size ‖∆ŵt+1‖2 . 2.3 EFFECTIVE STEP SIZES FOR VANILLA GRADIENT DESCENT ( GD ) . We approximate the effective step sizes for the scale-invariant w under the vanilla GD algorithm . We observe that the scale invariance f ( cw ) ≡ f ( w ) leads to the orthogonality : 0 = ∂f ( cw ) ∂c = w > ∇wf ( w ) . ( 4 ) For example , the vanilla GD update step p = ∇wf ( w ) is always perpendicular to w. Based on this , we establish the effective step size for w on Sd−1 : ‖∆ŵt+1‖2 : = ∥∥∥∥ wt+1 ‖wt+1‖2 − wt‖wt‖2 ∥∥∥∥ 2 ≈ ∥∥∥∥ wt+1 ‖wt+1‖2 − wt‖wt+1‖2 ∥∥∥∥ 2 = ‖∆wt+1‖2 ‖wt+1‖2 ( 5 ) where the approximation assumes 1‖wt+1‖2 − 1 ‖wt‖2 = o ( η ) , which holds when pt ⊥ wt as in the vanilla GD . We have thus derived that the effective step size on Sd−1 is inversely proportional to the weight norm , in line with the results in Hoffer et al . ( 2018 ) . Having established the relationship between the effective step sizes and the weight norm of a scaleinvariant parameters ( s.i.p ) , we derive the formula for its growth under the vanilla GD optimization . Lemma 2.1 ( Norm growth by GD , Lemma 2.4 in Arora et al . ( 2019 ) ) . For a s.i.p . w and the vanilla GD , where pt = ∇wf ( wt ) , ‖wt+1‖22 = ‖wt‖22 + η2‖pt‖22 . ( 6 ) The lemma follows from the orthogonality in equation 4 . It follows that the norm of a scale-invariant parameter ‖w‖2 is monotonically increasing and consequently decreases the effective step size for w. Arora et al . ( 2019 ) has further shown that GD with the above adaptive step sizes converges to a stationary point at the theoretically optimal convergence rate O ( T−1/2 ) under a fixed learning rate . 2.4 RAPID DECAY OF EFFECTIVE STEP SIZES FOR MOMENTUM-BASED GD . Momentum is designed to accelerate the convergence of gradient-based optimization by letting w escape high-curvature regions and cope with small and noisy gradients . It has become an indispensable ingredient for training modern deep neural networks . A momentum update follows : wt+1 ← wt − ηpt , pt ← βpt−1 +∇wtf ( wt ) ( 7 ) for steps t ≥ 0 , where β ∈ ( 0 , 1 ) and p−1 is initialized at 0 . Note that the step direction pt and the parameter wt may not be perpendicular anymore . We show below that momentum increases the weight norm under the scale invariance , even more so than does the vanilla GD . Lemma 2.2 ( Norm growth by momentum ) . For a s.i.p . w updated via equation 7 , we have ‖wt+1‖22 = ‖wt‖22 + η2‖pt‖22 + 2η2 t−1∑ k=0 βt−k‖pk‖22 . ( 8 ) Proof is in the Appendix §A . Comparing Lemma 2.1 and 2.2 , we notice that the formulation is identical , except for the last term on the right hand side of Lemma 2.2 . This term is not only non-negative , but also is an accumulation of the past updates . This additional term results in the significantly accelerated increase of weight norms when the momentum is used . We derive a more precise asymptotic ratio of the weight norms for the GD with and without momentum below . Corollary 2.3 ( Asymptotic norm growth comparison ) . Let ‖wGDt ‖2 and ‖wGDMt ‖2 be the weight norms at step t ≥ 0 , following the recursive formula in Lemma 2.1 and 2.2 , respectively . We assume that the norms of the updates ‖pt‖2 for GD with and without momentum are identical for every t ≥ 0 . We further assume that the sum of the update norms is non-zero and bounded : 0 < ∑ t≥0 ‖pt‖22 < ∞ . Then , the asymptotic ratio between the two norms is given by : ‖wGDMt ‖22 − ‖w0‖22 ‖wGDt ‖22 − ‖w0‖22 −→ 1 + 2β 1− β as t→∞ . ( 9 ) Proof in the Appendix §A . While the identity assumption for ‖pt‖2 between GD with and without momentum is strong , the theory is designed to illustrate an approximate norm growth ratios between the algorithms . For a popular choice of β = 0.9 , the factor is as high as 1 + 2β/ ( 1− β ) = 19 . Our observations are also applicable to Nesterov momentum and momentum-based adaptive optimizers like Adam . We later verify that the momentum induce the increase in weight norms and thus rapidly reduces the effective learning rates in many realistic setups of practical relevance ( §3.2 and §4 ) .
This paper points out that momentum in GD optimizers results in a far more rapid reduction in effective step sizes for scale-invariant weights. To solve the problem, two algorithms called SGDP and AdamP are proposed, which project the updates to tangent space of the parameter. Experiments on several tasks including image classification, language modeling, etc show the effectiveness of the proposed algorithms. The idea to study the integration of BN and momentum is interesting. The analyses and proposed algorithms provide guidance to practitioners.
SP:4e2ac2684ed817d9221154e922dabd54ff51fc90
Adversarial Attacks on Binary Image Recognition Systems
1 INTRODUCTION . In this paper we study adversarial attacks on models designed to classify binary ( i.e . black and white ) images . Models for binary image classification are heavily used across a variety of applications that include receipt processing , passport recognition , check processing , and license plate recognition , just to name a few . In such applications , the text recognition system typically binarizes the input image ( e.g . check processing ( Jayadevan et al. , 2012 ) , document extraction ( Gupta et al. , 2007 ) ) and trains a model to classify binary images . In recent years there has been an overwhelming interest in understanding the vulnerabilities of AI systems . In particular , a great deal of work has designed attacks on image classification models ( e.g . ( Szegedy et al. , 2013 ; Goodfellow et al. , 2014 ; Moosavi-Dezfooli et al. , 2016 ; Kurakin et al. , 2016 ; Papernot et al. , 2016 ; Madry et al. , 2017 ; Carlini & Wagner , 2017 ; Chen et al. , 2017 ; Ilyas et al. , 2018a ; b ; Tu et al. , 2019 ; Guo et al. , 2019 ; Li et al. , 2019 ) ) . Such attacks distort images in a manner that is virtually imperceptible to the human eye and yet cause state-of-the-art models to misclassify these images . Although there has been a great deal of work on attacking image classification models , these attacks are designed for colored and grayscale images . These attacks hide the noise in the distorted images by making minor perturbations in the color values of each pixel . Somewhat surprisingly , when it comes to binary images , the vulnerability of state-of-the-art models is poorly understood . In contrast to colored and grayscale images , the search space of attacks on binary images is extremely restricted and noise can not be hidden with minor perturbations of color values in each pixel . As a result , existing attack algorithms on machine learning systems do not apply to binary inputs . Since binary image classifiers are used in high-stakes decision making and are heavily used in banking and other multi-billion dollar industries , the natural question is : Are models for binary image classification used in industry vulnerable to adversarial attacks ? In this paper we initiate the study of attacks on binary image classifiers . We develop an attack algorithm , called SCAR , designed to fool binary image classifiers . SCAR carefully selects pixels to flip to the opposite color in a query efficient manner , which is a central challenge when attacking black-box models . We first show that SCAR outperforms existing attacks that we apply to the binary setting on multiple models trained over the MNIST and EMNIST datasets , as well as models for handwritten strings and printed word recognition . We then use SCAR to demonstrate the vulnerability of text recognition systems used in industry . We fool commercial check processing systems used by US banks for mobile check deposits . One major challenge in attacking these systems , whose software we licensed from providers , is that there are two independent classifiers , one for the amount written in words and one for the amount written in numbers , that must be fooled with the same wrong amount . Check fraud is a major concern for US banks , accounting for $ 1.3 billion in losses in 2018 ( American Bankers Association , 2020 ) . Since check fraud occurs at large scale , we believe that the vulnerability of check processing systems to adversarial attacks raises a serious concern . We also show that no attack can obtain reasonable guarantees on the number of pixel inversions needed to cause misclassification as there exist simple classifiers that are provably robust to large perturbations . There exist classifiers for d-dimensional binary images such that every class contains some image that requires Ω ( d ) pixel inversions ( L0 distance ) to change the label of that image and such that for every class , a random image in that class requires Ω ( √ d ) pixel inversions in expectation . Related work . The study of adversarial attacks was initiated in the seminal work by Szegedy et al . ( 2013 ) that showed that models for image classification are susceptible to minor perturbations in the input . There has since then been a long line of work developing attacks on colored and greyscale images . Most relevant to us are L0 attacks , which iteratively make minor perturbations in carefully chosen pixels to minimize the total number of pixels that have been modified ( Papernot et al. , 2016 ; Carlini & Wagner , 2017 ; Schott et al. , 2018 ; Guo et al. , 2019 ) . We compare our attack to two L0 attacks that are applicable in the black-box binary setting ( Schott et al. , 2018 ; Guo et al. , 2019 ) . Another related area of research focuses on developing attacks that query the model as few times as possible ( Chen et al. , 2017 ; Ilyas et al. , 2018a ; b ; Guo et al. , 2019 ; Li et al. , 2019 ; Tu et al. , 2019 ; Al-Dujaili & O ’ Reilly , 2019 ) . We discuss below why most of these attacks can not be applied to the binary setting . There has been previous work on attacking OCR systems ( Song & Shmatikov , 2018 ) , but the setting deals with grayscale images and white-box access to the model . Attacks on colored and grayscale images employ continuous optimization techniques and are fundamentally different than attacks on binary images which , due to the binary nature of each pixel , employ combinatorial optimization approaches . Previous work has formulated adversarial attack settings as combinatorial optimization problems , but in drastically different settings . Lei et al . ( 2018 ) consider attacks on text classification for tasks such as sentiment analysis and fake news detection , which is a different domain than OCR . Moon et al . ( 2019 ) formulate L∞ attacks on colored image classification as a combinatorial optimization problem where the search space for the change in each pixel is { −ε , ε } instead of [ −ε , ε ] . Finally , we also note that binarization , i.e . transforming colored or grayscale images into black and white images , has been studied as a technique to improve the robustness of models ( Schott et al. , 2018 ; Schmidt et al. , 2018 ; Ding et al. , 2019 ) . Previous attacks are ineffective in the binary setting . Previous attacks on grayscale ( or colored ) images are not directly applicable to our setting since they cause small perturbations in pixel values , which is not possible with binary images . One potential approach to use previous attacks is to relax the binary values to be in the grayscale range . However , the issue with this approach is that small changes in the relaxed grayscale domain are lost when rounding the pixel values back to being a valid binary input for the classifier . Another approach is to increase the step size of an attack such that a small change in a grayscale pixel value instead causes a binary pixel value to flip . This approach is most relevant to L0 attacks since they perturb a smaller number of pixels . However , even for the two L0 attacks which can be applied to the binary setting with this approach ( Guo et al. , 2019 ; Schott et al. , 2018 ) , this results in a large and visible number of pixel inversions , as shown in Section 6 . 2 PROBLEM FORMULATION . Binary images and OCR systems . Binary images x ∈ { 0 , 1 } d are d-dimensional images such that each pixel is either black or white . An m-class classifier F maps x to a probability distribution F ( x ) ∈ [ 0 , 1 ] m where F ( x ) i corresponds to the confidence that image x belongs to class i . The predicted label y of x is the class with the highest confidence , i.e. , y = arg maxi F ( x ) i. Optical Character Recognition ( OCR ) systems convert images of handwritten or printed text to strings of characters . Typically , a preprocessing step of OCR systems is to convert the input to a binary format . To formalize the problem of attacking OCR systems , we consider a classifier F where the labels are strings of characters . Given a binary image x with label y , we wish to produce an adversarial example x′ which is similar to x , but has a predicted label y′ 6= y . For example , given an image x of license plate 23FC6A , our goal is to produce a similar image x′ that is recognized as a different license plate number . We measure the similarity of an adversarial image x′ to the original image x with a perceptibility metric Dx ( x′ ) . For binary images , a natural metric is the number of pixels where x and x′ differ , which corresponds to the L0 distance between the two images . Finding an adversarial example can thus be formulated as the following optimization problem : min x′∈ { 0,1 } d ‖x−x′‖0≤k F ( x′ ) y where k is the maximum dissimilarity tolerated for adversarial image x′ . For targeted attacks with target label yt , we instead maximize F ( x′ ) yt . Since there are at least ( d k ) feasible solutions for x′ , which is exponential in k , this is a computationally hard problem . Check processing systems . A check processing system F accepts as input a binary image x of a check and outputs confidence scores F ( x ) which represent the most likely amounts that the check is for . Check processing systems are a special family of OCR systems that consist of two independent models that verify each other . Models FC and FL for Courtesy and Legal Amount Recognition ( CAR and LAR ) classify the amounts written in numbers and in words respectively . If the predicted labels of the two models do not match , the check is flagged . For example , if the CAR and LAR of a valid check read 100 and “ one hundred ” , the values match and the check is processed . The main challenge with attacking checks is to craft an adversarial example x′ with the same target label for both FC and FL . Returning to the previous example , a successful adversarial check image might have the CAR read 900 and the LAR read “ nine hundred ” . For this targeted attack , the optimization problem is : max x′∈ { 0,1 } d , yt 6=y ||x−x′||0≤k FC ( x ′ ) yt + FL ( x ′ ) yt subject to yt = argmaxiFC ( x ′ ) i = argmaxiFL ( x ′ ) i The attacker first needs to select a target amount yt different from the true amount y , and then attack FC and FL such that both misclassify x′ as amount yt . Since check processing systems also flag checks for which the models have low confidence in their predictions , we want to maximize both the probabilities FC ( x′ ) yt and FL ( x ′ ) yt . In order to have x ′ look as similar to x as possible , we also limit the number of modified pixels to be at most k. Check processing systems are configured such that FC and FL only output the probabilities for a limited number of their most probable amounts . This limitation makes the task of selecting a target amount challenging , as aside from the true amount , the most probable amounts for each of FC and FL may be disjoint sets . Black-box access . We assume that we do not have any information about the OCR model F and can only observe its outputs , which we formalize with the score-based black-box setting where an attacker only has access to the output probability distributions of a model F over queries x′ .
Adversarial attacks for binary image classification are unique from traditional attacks on color images due to its limited available space for perturbation. This paper proposes an algorithm that efficiently searches for valid attacks (both targeted and untargeted) which cause minimum flipped pixels. The proposed method is evaluated on digit classification, letter classification, and check processing systems. The baselines compared are mostly methods that were originally developed for color images.
SP:a77bf951ae279e9c2cd14f7f1d8066e7be62db15
Adversarial Attacks on Binary Image Recognition Systems
1 INTRODUCTION . In this paper we study adversarial attacks on models designed to classify binary ( i.e . black and white ) images . Models for binary image classification are heavily used across a variety of applications that include receipt processing , passport recognition , check processing , and license plate recognition , just to name a few . In such applications , the text recognition system typically binarizes the input image ( e.g . check processing ( Jayadevan et al. , 2012 ) , document extraction ( Gupta et al. , 2007 ) ) and trains a model to classify binary images . In recent years there has been an overwhelming interest in understanding the vulnerabilities of AI systems . In particular , a great deal of work has designed attacks on image classification models ( e.g . ( Szegedy et al. , 2013 ; Goodfellow et al. , 2014 ; Moosavi-Dezfooli et al. , 2016 ; Kurakin et al. , 2016 ; Papernot et al. , 2016 ; Madry et al. , 2017 ; Carlini & Wagner , 2017 ; Chen et al. , 2017 ; Ilyas et al. , 2018a ; b ; Tu et al. , 2019 ; Guo et al. , 2019 ; Li et al. , 2019 ) ) . Such attacks distort images in a manner that is virtually imperceptible to the human eye and yet cause state-of-the-art models to misclassify these images . Although there has been a great deal of work on attacking image classification models , these attacks are designed for colored and grayscale images . These attacks hide the noise in the distorted images by making minor perturbations in the color values of each pixel . Somewhat surprisingly , when it comes to binary images , the vulnerability of state-of-the-art models is poorly understood . In contrast to colored and grayscale images , the search space of attacks on binary images is extremely restricted and noise can not be hidden with minor perturbations of color values in each pixel . As a result , existing attack algorithms on machine learning systems do not apply to binary inputs . Since binary image classifiers are used in high-stakes decision making and are heavily used in banking and other multi-billion dollar industries , the natural question is : Are models for binary image classification used in industry vulnerable to adversarial attacks ? In this paper we initiate the study of attacks on binary image classifiers . We develop an attack algorithm , called SCAR , designed to fool binary image classifiers . SCAR carefully selects pixels to flip to the opposite color in a query efficient manner , which is a central challenge when attacking black-box models . We first show that SCAR outperforms existing attacks that we apply to the binary setting on multiple models trained over the MNIST and EMNIST datasets , as well as models for handwritten strings and printed word recognition . We then use SCAR to demonstrate the vulnerability of text recognition systems used in industry . We fool commercial check processing systems used by US banks for mobile check deposits . One major challenge in attacking these systems , whose software we licensed from providers , is that there are two independent classifiers , one for the amount written in words and one for the amount written in numbers , that must be fooled with the same wrong amount . Check fraud is a major concern for US banks , accounting for $ 1.3 billion in losses in 2018 ( American Bankers Association , 2020 ) . Since check fraud occurs at large scale , we believe that the vulnerability of check processing systems to adversarial attacks raises a serious concern . We also show that no attack can obtain reasonable guarantees on the number of pixel inversions needed to cause misclassification as there exist simple classifiers that are provably robust to large perturbations . There exist classifiers for d-dimensional binary images such that every class contains some image that requires Ω ( d ) pixel inversions ( L0 distance ) to change the label of that image and such that for every class , a random image in that class requires Ω ( √ d ) pixel inversions in expectation . Related work . The study of adversarial attacks was initiated in the seminal work by Szegedy et al . ( 2013 ) that showed that models for image classification are susceptible to minor perturbations in the input . There has since then been a long line of work developing attacks on colored and greyscale images . Most relevant to us are L0 attacks , which iteratively make minor perturbations in carefully chosen pixels to minimize the total number of pixels that have been modified ( Papernot et al. , 2016 ; Carlini & Wagner , 2017 ; Schott et al. , 2018 ; Guo et al. , 2019 ) . We compare our attack to two L0 attacks that are applicable in the black-box binary setting ( Schott et al. , 2018 ; Guo et al. , 2019 ) . Another related area of research focuses on developing attacks that query the model as few times as possible ( Chen et al. , 2017 ; Ilyas et al. , 2018a ; b ; Guo et al. , 2019 ; Li et al. , 2019 ; Tu et al. , 2019 ; Al-Dujaili & O ’ Reilly , 2019 ) . We discuss below why most of these attacks can not be applied to the binary setting . There has been previous work on attacking OCR systems ( Song & Shmatikov , 2018 ) , but the setting deals with grayscale images and white-box access to the model . Attacks on colored and grayscale images employ continuous optimization techniques and are fundamentally different than attacks on binary images which , due to the binary nature of each pixel , employ combinatorial optimization approaches . Previous work has formulated adversarial attack settings as combinatorial optimization problems , but in drastically different settings . Lei et al . ( 2018 ) consider attacks on text classification for tasks such as sentiment analysis and fake news detection , which is a different domain than OCR . Moon et al . ( 2019 ) formulate L∞ attacks on colored image classification as a combinatorial optimization problem where the search space for the change in each pixel is { −ε , ε } instead of [ −ε , ε ] . Finally , we also note that binarization , i.e . transforming colored or grayscale images into black and white images , has been studied as a technique to improve the robustness of models ( Schott et al. , 2018 ; Schmidt et al. , 2018 ; Ding et al. , 2019 ) . Previous attacks are ineffective in the binary setting . Previous attacks on grayscale ( or colored ) images are not directly applicable to our setting since they cause small perturbations in pixel values , which is not possible with binary images . One potential approach to use previous attacks is to relax the binary values to be in the grayscale range . However , the issue with this approach is that small changes in the relaxed grayscale domain are lost when rounding the pixel values back to being a valid binary input for the classifier . Another approach is to increase the step size of an attack such that a small change in a grayscale pixel value instead causes a binary pixel value to flip . This approach is most relevant to L0 attacks since they perturb a smaller number of pixels . However , even for the two L0 attacks which can be applied to the binary setting with this approach ( Guo et al. , 2019 ; Schott et al. , 2018 ) , this results in a large and visible number of pixel inversions , as shown in Section 6 . 2 PROBLEM FORMULATION . Binary images and OCR systems . Binary images x ∈ { 0 , 1 } d are d-dimensional images such that each pixel is either black or white . An m-class classifier F maps x to a probability distribution F ( x ) ∈ [ 0 , 1 ] m where F ( x ) i corresponds to the confidence that image x belongs to class i . The predicted label y of x is the class with the highest confidence , i.e. , y = arg maxi F ( x ) i. Optical Character Recognition ( OCR ) systems convert images of handwritten or printed text to strings of characters . Typically , a preprocessing step of OCR systems is to convert the input to a binary format . To formalize the problem of attacking OCR systems , we consider a classifier F where the labels are strings of characters . Given a binary image x with label y , we wish to produce an adversarial example x′ which is similar to x , but has a predicted label y′ 6= y . For example , given an image x of license plate 23FC6A , our goal is to produce a similar image x′ that is recognized as a different license plate number . We measure the similarity of an adversarial image x′ to the original image x with a perceptibility metric Dx ( x′ ) . For binary images , a natural metric is the number of pixels where x and x′ differ , which corresponds to the L0 distance between the two images . Finding an adversarial example can thus be formulated as the following optimization problem : min x′∈ { 0,1 } d ‖x−x′‖0≤k F ( x′ ) y where k is the maximum dissimilarity tolerated for adversarial image x′ . For targeted attacks with target label yt , we instead maximize F ( x′ ) yt . Since there are at least ( d k ) feasible solutions for x′ , which is exponential in k , this is a computationally hard problem . Check processing systems . A check processing system F accepts as input a binary image x of a check and outputs confidence scores F ( x ) which represent the most likely amounts that the check is for . Check processing systems are a special family of OCR systems that consist of two independent models that verify each other . Models FC and FL for Courtesy and Legal Amount Recognition ( CAR and LAR ) classify the amounts written in numbers and in words respectively . If the predicted labels of the two models do not match , the check is flagged . For example , if the CAR and LAR of a valid check read 100 and “ one hundred ” , the values match and the check is processed . The main challenge with attacking checks is to craft an adversarial example x′ with the same target label for both FC and FL . Returning to the previous example , a successful adversarial check image might have the CAR read 900 and the LAR read “ nine hundred ” . For this targeted attack , the optimization problem is : max x′∈ { 0,1 } d , yt 6=y ||x−x′||0≤k FC ( x ′ ) yt + FL ( x ′ ) yt subject to yt = argmaxiFC ( x ′ ) i = argmaxiFL ( x ′ ) i The attacker first needs to select a target amount yt different from the true amount y , and then attack FC and FL such that both misclassify x′ as amount yt . Since check processing systems also flag checks for which the models have low confidence in their predictions , we want to maximize both the probabilities FC ( x′ ) yt and FL ( x ′ ) yt . In order to have x ′ look as similar to x as possible , we also limit the number of modified pixels to be at most k. Check processing systems are configured such that FC and FL only output the probabilities for a limited number of their most probable amounts . This limitation makes the task of selecting a target amount challenging , as aside from the true amount , the most probable amounts for each of FC and FL may be disjoint sets . Black-box access . We assume that we do not have any information about the OCR model F and can only observe its outputs , which we formalize with the score-based black-box setting where an attacker only has access to the output probability distributions of a model F over queries x′ .
The main question this paper aims to answer is how vulnerable binary image classification systems are. This is an important question because of the application of such binary image classifications for check processing, invoice processing, and license plate registration. One also would think that such systems are less vulnerable to adversarial attacks given the simplicity of their inputs and the fact that most adversarial attacks are based on color or grey scale images. The authors propose an adversarial attack algorithm called SCAR that efficiently flips the binary pixels with reasonable number of queries in order to confuse the classifier to return a desirable label with high confidence. The authors show that the proposed method outperforms the existing baselines on multiple data sets. Very interestingly, they also showed that their algorithm is able to attack the online deposit systems of US bank with a high success rate. Their example of a check with the amount of $401 that is minimally modified for the amount of $701 is quite significant given that the model had to change both the word and numbers on the check.
SP:a77bf951ae279e9c2cd14f7f1d8066e7be62db15
Continual learning with neural activation importance
1 INTRODUCTION . Continual learning , or sequential learning , is a concept of online learning along multiple sequential tasks . The aim of continual learning is learning a set of related tasks that are observed irregularly or separately online . Therefore each task does not necessarily contain overlapped classes with others and , in worst case , different tasks consist of mutually disjoint classes . Therefore , in continual learning , one of the main challenges is training new tasks with new classes without catastrophic forgetting existing knowledge of prior tasks ( and their classes ) . A model adapts to a new task without access to some or entire classes of past tasks but keeping and maintaining acquired knowledge from new tasks ( Thrun , 1996 ) . Since the training of a neural network is influenced more by recently and frequently observed data , a machine learning model forgets what it has learned in prior tasks without continuing access to them in the current task . On the other hand , rigorous methods that maintain the knowledge of entire previous tasks are impractical in adapting new tasks . Thus , researchers have developed diverse methods to achieve both stability ( remembering past tasks ) and plasticity ( adapting new tasks ) in continual learning . There are three major types in previous continual learning methods ; 1 ) architectural approaches modifying the architecture of neural networks ( Yoon et al. , 2017 ; Sharif Razavian et al. , 2014 ; Rusu et al. , 2016 ) , 2 ) rehearsal approaches using sampled data from previous tasks ( Riemer et al. , 2018 ; Aljundi et al. , 2019 ; Gupta et al. , 2020 ) , and 3 ) regularization approaches freezing significant weights of a model calculating the importance of weights or neurons ( Li & Hoiem , 2017 ; Kirkpatrick et al. , 2017 ; Zenke et al. , 2017 ; Nguyen et al. , 2017 ; Aljundi et al. , 2018a ; b ; Zeno et al. , 2018 ; Ahn et al. , 2019 ; Javed & White , 2019 ; Jung et al. , 2020 ) . Most recent regularization methods have tackled the problem in more fundamental way with regularization approaches that utilize the weights of a given network to the hit . The basic idea of regularization approaches is to constrain essential weights of old tasks not to change . In general , they alleviate catastrophic interference by imposing a penalty on the difference of weights between the past tasks and the current task . The degree of the penalty follows the importance of weights or neurons with respective measurements . Significance of an weight stands for how important the weight is in solving a certain task . EWC ( Kirkpatrick et al. , 2017 ) introduces elastic weight consolidation which estimates parameter importance using the diagonal of the Fisher information matrix equivalent to the second derivative of the loss . However , they compute weights ’ importance after network training . SI ( Zenke et al. , 2017 ) measures the importance of weights in an online manner by calculating each parameter ’ s sensitivity to the loss change while training a task . To be specific , when a certain parameter changes slightly during training batches but its contribution to the loss is high ( i.e. , rapid change of its gradient ) , the parameter is considered to be crucial and restricted to be updated while learning future tasks . However , the accuracy of their method shows limited stability even with the same order of tasks of test data . Unlike Zenke et al . ( 2017 ) , MAS ( Aljundi et al. , 2018a ) assesses the contribution of each weight to the change of learned function . In other words , it considers the gradient of outputs of a model with a mean square error loss . Gradient itself represents a change of outputs with respect to the weights . The strength of the method lies in the scheme of data utilization . It considers only the degree of change of output values of the network , so that any data ( even unlabeled one ) is valid to compute the gradient of the learned function with regard to weights . VCL ( Nguyen et al. , 2017 ) is a Bayesian neural network based method . It decides weight importance through variational inference . BGD ( Zeno et al. , 2018 ) is another Bayesian neural network based apporoach . In this method , it finds posterior parameters ( e.g . mean and variance ) assuming that posterior and the prior distribution are Gaussian . These methods ( Kirkpatrick et al. , 2017 ; Zenke et al. , 2017 ; Aljundi et al. , 2018a ; Nguyen et al. , 2017 ; Zeno et al. , 2018 ) calculate and assign importance to weights directly as describe in Figure 1a . In order to alleviate interference across multiple tasks , weight importance based approaches such as EWC , SI , and MAS assign importance Ωk to each weight ωk in the network . However , in the case of convolutional neural networks , weights in the same convolutional filter map should have the same importance . Furthermore , since those methods basically consider the amount of change of weight , it is impossible to reinitialize weights at each training of a new task , which decreases the plasticity of the network . ( Additional explanation of weight reinitialization is discussed in section 2.2 ) UCL ( Ahn et al. , 2019 ) propose a Bayesian neural network based method to mitigate catastrophic forgetting by incorporating weight uncertainty measurement indicating the variance of weight distribution . They claim that the distribution of essential weights for past tasks has low variance and such stable weights during training a task are regarded as important weight not to forget . As illustrated in Figure 1b , they suggest a node based importance in neural network . First , the smallest variance among the weights incoming to and outgoing from a corresponding neuron decides the importance of the neuron , and then all those weights take the same neurons importance as their weight importance . Ahn et al . ( 2019 ) is applicable only to a Bayesian neural network and highly dependent upon hyper-parameters . Furthermore , it is computationally expensive to train compared to Zenke et al . ( 2017 ) and our proposed method . Jung et al . ( 2020 ) is another recent algorithm based on neuron importance . Its node importance depends on the average activation value . This idea is simple but powerful . Activation value itself is a measurement of neuron importance , and weights connected to the neuron get identical weight importance . This corresponds to the type in Figure 1c . One of our key observations in prior experimental evaluations is that the accuracy of each task significantly changes when we change the order of tasks , as it is also claimed and discussed in ( Yoon et al. , 2019 ) proposing a order robust method of continual learning in their architectural approach . Evaluating with fixed task order does not coincide with the fundamental aim of continual learning where no dedicated order of tasks is given . Figure 2 shows example test results of state of the art continual learning methods compared to our proposed method . Classification accuracy values of prior methods fluctuate as the order of tasks changes ( from Figure 2a to Figure 2b ) . Based on the observation , we propose to evaluate the robustness to the order of tasks in comprehensive manner in which we evaluate the average and standard deviation of classification accuracy with multiple sets of randomly shuffled orders . The key contributions of our work are as follows : • We propose a simple but intuitive and effective continual learning method introducing activation based neuron importance . • We propose a comprehensive experimental evaluation framework on existing benchmark data sets to evaluate not just the final accuracy of continual learning also the robustness of the accuracy along the changes of the order of tasks . Based on the evaluation framework , existing state-of-the-art methods as well as our proposed method are extensively evaluated . 2 PROPOSED METHOD . 2.1 NEURON IMPORTANCE WITH AVERAGE OF ACTIVATION VALUE . As French ( 1991 ) and French ( 1999 ) suggested , since activation overlap causes catastrophic forgetting , a successful network is required to build representations with as little overlap of activation as possible across continual tasks , called sparse representations , to mitigate mutual interference . If a network builds dense representation , a small amount of changes in the representation affects the stability of all trained classes since nodes and weights in a network are in casual relations . On the other hand , if a network produces distributed representations for all classes , alteration of representation for certain class does not affect others . In our method , we adopt NM-NI ( Node Measurement , Node Importance ) type in Figure 1c based in the measurement of activation value at each neuron . Similar to Jung et al . ( 2020 ) , we measure the average activation value of kth neuron as its neuron importance Ωk . Incoming weights connected to the same neurons have the same importance . In the case of convolutional neural networks , the average activation value corresponds to the average activation value of a feature map ( i.e. , global average pooling value ) . Average activation value itself , however , is not able to fully represent the characteristics of an essential neuron . Encoded features at each layer describe different aspects of an input image and , as a result , activation at each layer can not be evaluated together . Due to the difference in absolute average activation values across the layers , weights of earlier layers tend to be considered more essential as Figure 3 shows . If average activation value is used as neuron importance , method will prefer to keep the weights of earlier layers . Instead , we propose to use layer-wise average activation divided by respective standard deviation for importance measurement . Even though it is a simple extension of ( Jung et al. , 2020 ) , it prevents a particular layer from getting excessive importance compared to other layers , that , in turn , prevents our network from overfitting to a particular task keeping its plasticity regardless of task order . As Figure 19a shows , for each method , normalized average weight importance of each layer ( total 6 layers ) is calculated . Prior average activation based regularization term assigns around 57 % of total importance to layer 1 ( 57 % , 12 % , 10 % , 6 % , 8 % , 8 % , respectively for the 6 layers ) . On the other hand , our proposed regularization loss term assigns 26 % of total importance to layer 1 . Furthermore , our method avoids assigning excessive importance to certain layer ( 26 % , 16 % , 16 % , 15 % , 15 % , 12 % ) . Then , why this improves the continual learning performance regardless of task order ? In prior works , more weights of lower layers tend to be frozen in earlier tasks that eliminate the chance of upcoming tasks to build new low-level feature sets . Only a new task that is fortunately able to rebuild higher layer features based on the frozen lower layer weights from previous tasks could survive . On the other hand , ours keeps the balance of frozen weights in all layers securing more freedom of feature descriptions for new tasks in both lower and higher layers . Indeed , lower layer features such as edges are not class ( task ) dependent features . Therefore , freezing lower layer features actually is not preferable in continual learning . Even though lower level features are mostly changed over tasks , new task may find alternative lower level features keeping its plasticity . On the other hand , if the network fails to freeze some higher level features that are class ( task ) dependent , it may lose robustness . As we have seen , prior works spend most of their importance to lower layers losing its robustness . In order to encode such relation , we propose to use average and std . of activation values of each layer rather than using weighs directly . Our loss function is described as follows . Lt = L̃t + α ∑ l Ωtnk ( w t−1 l − w t l ) 2 , ( 1 ) where L̃t is loss of current task , t is task index , l is weight index , and Ωtnk indicates k th neuron importance . α is a strength parameter to control the amount of weights consolidation . Neuron importance is defined as follows . Ωtnk = 1 Nt Nt∑ i=1 fnk ( x ( t ) i ) σ + , σ = √√√√√ Nt∑i=1 { fk ( x ( t ) i ) − 1Nt Nt∑i=1 fk ( x ( t ) i ) } 2 Nt , ( 2 ) whereNt is the number of instances , k is neuron index , fk ( · ) is activation value , and i is instance index . We introduce to prevent the numerator from being zero when the standard deviation becomes zero .
This paper proposes a method that tackles the problem of catastrophic forgetting in continual neural networks by assigning importance to neuron activations while tasks are executed in sequence. Similar to previous research (Jung et al., 2020), the proposed method measures neuron importance using average activation values divided by corresponding standard deviation. This strategy is accompanied by weight re-initialization to guarantee that new tasks are fully learned. The method is tested in benchmark datasets for continual learning.
SP:e0bef945605bdba26787c47c6c8ecaa896610b54
Continual learning with neural activation importance
1 INTRODUCTION . Continual learning , or sequential learning , is a concept of online learning along multiple sequential tasks . The aim of continual learning is learning a set of related tasks that are observed irregularly or separately online . Therefore each task does not necessarily contain overlapped classes with others and , in worst case , different tasks consist of mutually disjoint classes . Therefore , in continual learning , one of the main challenges is training new tasks with new classes without catastrophic forgetting existing knowledge of prior tasks ( and their classes ) . A model adapts to a new task without access to some or entire classes of past tasks but keeping and maintaining acquired knowledge from new tasks ( Thrun , 1996 ) . Since the training of a neural network is influenced more by recently and frequently observed data , a machine learning model forgets what it has learned in prior tasks without continuing access to them in the current task . On the other hand , rigorous methods that maintain the knowledge of entire previous tasks are impractical in adapting new tasks . Thus , researchers have developed diverse methods to achieve both stability ( remembering past tasks ) and plasticity ( adapting new tasks ) in continual learning . There are three major types in previous continual learning methods ; 1 ) architectural approaches modifying the architecture of neural networks ( Yoon et al. , 2017 ; Sharif Razavian et al. , 2014 ; Rusu et al. , 2016 ) , 2 ) rehearsal approaches using sampled data from previous tasks ( Riemer et al. , 2018 ; Aljundi et al. , 2019 ; Gupta et al. , 2020 ) , and 3 ) regularization approaches freezing significant weights of a model calculating the importance of weights or neurons ( Li & Hoiem , 2017 ; Kirkpatrick et al. , 2017 ; Zenke et al. , 2017 ; Nguyen et al. , 2017 ; Aljundi et al. , 2018a ; b ; Zeno et al. , 2018 ; Ahn et al. , 2019 ; Javed & White , 2019 ; Jung et al. , 2020 ) . Most recent regularization methods have tackled the problem in more fundamental way with regularization approaches that utilize the weights of a given network to the hit . The basic idea of regularization approaches is to constrain essential weights of old tasks not to change . In general , they alleviate catastrophic interference by imposing a penalty on the difference of weights between the past tasks and the current task . The degree of the penalty follows the importance of weights or neurons with respective measurements . Significance of an weight stands for how important the weight is in solving a certain task . EWC ( Kirkpatrick et al. , 2017 ) introduces elastic weight consolidation which estimates parameter importance using the diagonal of the Fisher information matrix equivalent to the second derivative of the loss . However , they compute weights ’ importance after network training . SI ( Zenke et al. , 2017 ) measures the importance of weights in an online manner by calculating each parameter ’ s sensitivity to the loss change while training a task . To be specific , when a certain parameter changes slightly during training batches but its contribution to the loss is high ( i.e. , rapid change of its gradient ) , the parameter is considered to be crucial and restricted to be updated while learning future tasks . However , the accuracy of their method shows limited stability even with the same order of tasks of test data . Unlike Zenke et al . ( 2017 ) , MAS ( Aljundi et al. , 2018a ) assesses the contribution of each weight to the change of learned function . In other words , it considers the gradient of outputs of a model with a mean square error loss . Gradient itself represents a change of outputs with respect to the weights . The strength of the method lies in the scheme of data utilization . It considers only the degree of change of output values of the network , so that any data ( even unlabeled one ) is valid to compute the gradient of the learned function with regard to weights . VCL ( Nguyen et al. , 2017 ) is a Bayesian neural network based method . It decides weight importance through variational inference . BGD ( Zeno et al. , 2018 ) is another Bayesian neural network based apporoach . In this method , it finds posterior parameters ( e.g . mean and variance ) assuming that posterior and the prior distribution are Gaussian . These methods ( Kirkpatrick et al. , 2017 ; Zenke et al. , 2017 ; Aljundi et al. , 2018a ; Nguyen et al. , 2017 ; Zeno et al. , 2018 ) calculate and assign importance to weights directly as describe in Figure 1a . In order to alleviate interference across multiple tasks , weight importance based approaches such as EWC , SI , and MAS assign importance Ωk to each weight ωk in the network . However , in the case of convolutional neural networks , weights in the same convolutional filter map should have the same importance . Furthermore , since those methods basically consider the amount of change of weight , it is impossible to reinitialize weights at each training of a new task , which decreases the plasticity of the network . ( Additional explanation of weight reinitialization is discussed in section 2.2 ) UCL ( Ahn et al. , 2019 ) propose a Bayesian neural network based method to mitigate catastrophic forgetting by incorporating weight uncertainty measurement indicating the variance of weight distribution . They claim that the distribution of essential weights for past tasks has low variance and such stable weights during training a task are regarded as important weight not to forget . As illustrated in Figure 1b , they suggest a node based importance in neural network . First , the smallest variance among the weights incoming to and outgoing from a corresponding neuron decides the importance of the neuron , and then all those weights take the same neurons importance as their weight importance . Ahn et al . ( 2019 ) is applicable only to a Bayesian neural network and highly dependent upon hyper-parameters . Furthermore , it is computationally expensive to train compared to Zenke et al . ( 2017 ) and our proposed method . Jung et al . ( 2020 ) is another recent algorithm based on neuron importance . Its node importance depends on the average activation value . This idea is simple but powerful . Activation value itself is a measurement of neuron importance , and weights connected to the neuron get identical weight importance . This corresponds to the type in Figure 1c . One of our key observations in prior experimental evaluations is that the accuracy of each task significantly changes when we change the order of tasks , as it is also claimed and discussed in ( Yoon et al. , 2019 ) proposing a order robust method of continual learning in their architectural approach . Evaluating with fixed task order does not coincide with the fundamental aim of continual learning where no dedicated order of tasks is given . Figure 2 shows example test results of state of the art continual learning methods compared to our proposed method . Classification accuracy values of prior methods fluctuate as the order of tasks changes ( from Figure 2a to Figure 2b ) . Based on the observation , we propose to evaluate the robustness to the order of tasks in comprehensive manner in which we evaluate the average and standard deviation of classification accuracy with multiple sets of randomly shuffled orders . The key contributions of our work are as follows : • We propose a simple but intuitive and effective continual learning method introducing activation based neuron importance . • We propose a comprehensive experimental evaluation framework on existing benchmark data sets to evaluate not just the final accuracy of continual learning also the robustness of the accuracy along the changes of the order of tasks . Based on the evaluation framework , existing state-of-the-art methods as well as our proposed method are extensively evaluated . 2 PROPOSED METHOD . 2.1 NEURON IMPORTANCE WITH AVERAGE OF ACTIVATION VALUE . As French ( 1991 ) and French ( 1999 ) suggested , since activation overlap causes catastrophic forgetting , a successful network is required to build representations with as little overlap of activation as possible across continual tasks , called sparse representations , to mitigate mutual interference . If a network builds dense representation , a small amount of changes in the representation affects the stability of all trained classes since nodes and weights in a network are in casual relations . On the other hand , if a network produces distributed representations for all classes , alteration of representation for certain class does not affect others . In our method , we adopt NM-NI ( Node Measurement , Node Importance ) type in Figure 1c based in the measurement of activation value at each neuron . Similar to Jung et al . ( 2020 ) , we measure the average activation value of kth neuron as its neuron importance Ωk . Incoming weights connected to the same neurons have the same importance . In the case of convolutional neural networks , the average activation value corresponds to the average activation value of a feature map ( i.e. , global average pooling value ) . Average activation value itself , however , is not able to fully represent the characteristics of an essential neuron . Encoded features at each layer describe different aspects of an input image and , as a result , activation at each layer can not be evaluated together . Due to the difference in absolute average activation values across the layers , weights of earlier layers tend to be considered more essential as Figure 3 shows . If average activation value is used as neuron importance , method will prefer to keep the weights of earlier layers . Instead , we propose to use layer-wise average activation divided by respective standard deviation for importance measurement . Even though it is a simple extension of ( Jung et al. , 2020 ) , it prevents a particular layer from getting excessive importance compared to other layers , that , in turn , prevents our network from overfitting to a particular task keeping its plasticity regardless of task order . As Figure 19a shows , for each method , normalized average weight importance of each layer ( total 6 layers ) is calculated . Prior average activation based regularization term assigns around 57 % of total importance to layer 1 ( 57 % , 12 % , 10 % , 6 % , 8 % , 8 % , respectively for the 6 layers ) . On the other hand , our proposed regularization loss term assigns 26 % of total importance to layer 1 . Furthermore , our method avoids assigning excessive importance to certain layer ( 26 % , 16 % , 16 % , 15 % , 15 % , 12 % ) . Then , why this improves the continual learning performance regardless of task order ? In prior works , more weights of lower layers tend to be frozen in earlier tasks that eliminate the chance of upcoming tasks to build new low-level feature sets . Only a new task that is fortunately able to rebuild higher layer features based on the frozen lower layer weights from previous tasks could survive . On the other hand , ours keeps the balance of frozen weights in all layers securing more freedom of feature descriptions for new tasks in both lower and higher layers . Indeed , lower layer features such as edges are not class ( task ) dependent features . Therefore , freezing lower layer features actually is not preferable in continual learning . Even though lower level features are mostly changed over tasks , new task may find alternative lower level features keeping its plasticity . On the other hand , if the network fails to freeze some higher level features that are class ( task ) dependent , it may lose robustness . As we have seen , prior works spend most of their importance to lower layers losing its robustness . In order to encode such relation , we propose to use average and std . of activation values of each layer rather than using weighs directly . Our loss function is described as follows . Lt = L̃t + α ∑ l Ωtnk ( w t−1 l − w t l ) 2 , ( 1 ) where L̃t is loss of current task , t is task index , l is weight index , and Ωtnk indicates k th neuron importance . α is a strength parameter to control the amount of weights consolidation . Neuron importance is defined as follows . Ωtnk = 1 Nt Nt∑ i=1 fnk ( x ( t ) i ) σ + , σ = √√√√√ Nt∑i=1 { fk ( x ( t ) i ) − 1Nt Nt∑i=1 fk ( x ( t ) i ) } 2 Nt , ( 2 ) whereNt is the number of instances , k is neuron index , fk ( · ) is activation value , and i is instance index . We introduce to prevent the numerator from being zero when the standard deviation becomes zero .
This paper introduces a regularization approach for stable continual learning of sequential tasks. The proposed method computes neuron importance based on the activation values of nodes with their respective standard deviation. It further suggests a weight re-initialization scheme to achieve better performance. Experimental results on several continual learning scenarios show that the presented approach is comparable to other existing competitors.
SP:e0bef945605bdba26787c47c6c8ecaa896610b54
Temporal and Object Quantification Nets
1 INTRODUCTION . When watching a soccer match ( Fig . 1 ) , we see more than just players and a ball moving around . Rather , we see events and actions in terms of high-level concepts , including relations between agents and objects . For example , people can easily recognize when one player has control of the ball , or when a player passed the ball to another player . This cognitive act is effortless , intuitive , and fast . Machines can recognize actions , too , but generally based on limited windows of space and time , and with weak generalization . Consider the variety of complicated spatio-temporal trajectories that passing can refer to ( Fig . 1 ) , and how an intelligent agent could learn this . The act of passing does not seem to be about the pixel-level specifics of the spatio-temporal trajectory . Rather , a pass is a high-level action-concept that is composed of other concepts , such as possession ( A pass begins with one player in possession of the ball and ends with another player in possession ) or kick . The concept of passing can itself be re-used in a compositional way , for example to distinguish between a short pass and a long pass . We propose Temporal and Object Quantification Nets ( TOQ-Nets ) , structured neural networks that learn to describe complex activities by quantifying over both entities and time . TOQ-Nets are motivated by the way in which humans perceive actions in terms of the properties of and relations between agents and objects , and the sequential structure of events ( Zacks et al. , 2007 ; Stränger & Hommel , 1996 ) . A TOQ-Net is a multi-layer neural network whose inputs are the properties of agents and objects and their relationships in a scene , which may change over time . In a soccer game , these inputs might be the 3D position of each player and the ball . Each layer in the TOQ-Net performs either object or temporal quantification , which can emulate and realize disjunctive and conjunctive quantification over the properties and relationships between entities , as in “ the kicker is behind all the other players ” , as well as quantification over time , as in “ the player controls the ball until it moves fast towards the goal. ” The key idea of TOQ-Nets is to use tensors to represent the relational features between agents and objects ( e.g. , the player controls the ball , and the ball is moving fast ) , and to use tensor pooling operations over different dimensions to realize temporal and object quantifiers ( all and until ) . Thus , by stacking these object and temporal quantification operations , TOQ-Nets can learn to construct higher-level concepts of actions based on the relations between entities over time , starting from low-level position and velocity input and supervised with only high-level class labels . We evaluate TOQ-Nets on two perceptually and conceptually different benchmarks for action recognition : trajectory-based soccer event detection and 6D pose-based manipulation concept learning . We show that the TOQ-Net makes several important contributions . First , TOQ-Nets outperform both convolutional and recurrent baselines for modeling relational-temporal concepts across both benchmarks . Second , by exploiting the temporal-relational features learned through supervised learning , TOQ-Nets achieve strong few-shot generalization to novel actions . Finally , TOQ-Nets exhibit strong generalization to scenarios where there are more agents and objects than were present during training . They are also robust w.r.t . time warped input trajectories . Meanwhile , the learned concepts can also be easily transferred to other prediction tasks in a similar domain . 2 RELATED WORK . Action concept representations and learning . TOQ-Nets impose a structural inductive bias that describes actions with quantification over objects ( every entity ... , there exists an entity ... ) and quantification over times ( an event happens until some time and then some other event begins ) , which is motivated by first-order and linear temporal logics ( Pnueli , 1977 ) . Such representations have been studied for analyzing sporting events ( Intille & Bobick , 1999 ; 2001 ) and daily actions ( Tran & Davis , 2008 ; Brendel et al. , 2011 ) using logic-based reasoning frameworks . However , these frameworks require extra knowledge to annotate relationships between low-level , primitive actions and complex ones . By contrast , TOQ-Nets enable end-to-end learning of complex action descriptions with only high-level action-class labels . Cognitive science has long recognized the importance of structural representations of actions and events in human reasoning , including in language , memory , perception , and development ( see e.g . Stränger & Hommel , 1996 ; Zacks et al. , 2001 ; 2007 ; Pinker , 2007 ; Baldwin et al. , 2001 ) . In this paper , we focus on the role of object and temporal quantification in learning action representations . Temporal and relational reasoning . This paper is also related to work on using neural networks and other data-driven models for modeling temporal structure . Early work includes ADL description languages ( Intille & Bobick , 1999 ; Zhuo et al. , 2019 ) , hidden Markov models ( Tang et al. , 2012 ) , and and-or graphs ( Gupta et al. , 2009 ; Tang et al. , 2013 ) . These models need human-annotated action descriptions ( e.g. , pick up x means a state transition from not holding x to holding x ) and specialpurpose inference algorithms such as graph structure learning algorithms . In contrast , TOQ-Nets have an end-to-end design and can be integrated with arbitrary differentiable modules such as convolutional neural networks . People have also used structural representations to model object-centric temporal concepts with temporal graph convolution networks ( Yan et al. , 2018 ; Materzynska et al. , 2020 ; Wang & Gupta , 2018 ; Ji et al. , 2020 ) . Meanwhile , Deng et al . ( 2016 ) proposed to integrate graph neural networks with RNNs by replacing the message aggregation step in GNN propagation with RNNs to capture temporal information . Bialkowski et al . ( 2014 ) ; Ibrahim et al . ( 2016 ) ) have proposed to build a personal-level and a group-level feature extractor for group activity recognition . The high-level idea is to use RNNs to encode per-person features across the video and use another RNN to combine features of individual persons into a group feature for every frame . StagNet Qi et al . ( 2018 ) and Spatial-Temporal Interaction Networks ( Materzynska et al. , 2020 ) combines graph neural networks with RNNs and spatial-temporal attention models to model temporal information . TOQ-Nets use a similar object-centric relational representation , but different models for temporal structures . There are also alternative models for temporal structures from pixels , such as convolutions ( Carreira & Zisserman , 2017 ; Ji et al. , 2020 ) , recurrent networks ( Dong et al. , 2019 ) , attention ( Wang et al. , 2018 ) , or segmentation consensus and its variants ( Wang et al. , 2016 ; Zhou et al. , 2018 ) . In contrast to these methods , TOQ-Nets works on an object-centric temporal-relational feature space , and uses the proposed temporal quantification operations to model the sequential structures of events . 3 TEMPORAL AND OBJECT QUANTIFICATION NETS . TOQ-Nets , shown in Fig . 2 , are multi-layer neural networks with a structural inductive bias for learning composable action concepts using object and temporal quantification . The input to a TOQNet is a tensor representation of the properties of all entities at each moment in time . For example , in a soccer game , the input encodes the position of each player and the ball , as well as the team membership of each player . The output is a label for the action performed by a target entity . The first layer of a TOQ-Net ( Fig . 2 ( i ) ) extracts temporal features for each entity with an input feature extractor that focuses on entity features within a fixed and local time window . These features may be computed by a convolutional neural network , such as STGCN ( Yan et al. , 2018 ) or a bank of parametric feature templates , such as thresholding the velocity of an entity : whether the velocity of an entity x is greater than a learnable parameter θ at time t. The output of this step is thus a collection of nullary , unary , and binary relational features over time for all entities . Throughout the paper we will assume that all output tensors of this layer are binary-valued , although the one can easily extend this feature extractor to any real-valued function . This input feature extractor is usually task- and dataset-specific and is not the main focus of this paper . Second , the temporal-relational features go through several relational reasoning layers , which we present in detail in Section 3.2 . In short , each layer at this step performs linear transformations , sigmoid activation , and object quantification operations . The linear and sigmoid functions allow the network to realize Boolean logical forms , and object quantification operators can realize quantifiers . With more relational reasoning layers , the network can realize logical forms with more quantifiers , as illustrated in Fig . 2 . All operators in these layers are performed for all time steps in parallel . Next , the relational reasoning layers summarize each event at a particular time step as a nullary feature that is passed to the to the temporal reasoning layer , as detailed in Section 3.3 . Each layer at this step performs linear transformations , sigmoid activation , and temporal quantification . They allow the model to realize logical forms in a simple linear temporal logic ( Pnueli , 1977 ) , such as always ∃x . q1 ( x ) ∧ q2 ( x ) . This is semantically equivalent to the temporally quantified expression ∀t . ∃x . q1 ( x , t ) ∧q2 ( x , t ) . Similar to the relational reasoning layers , adding more temporal reasoning layers enables the network to realize logical forms with more deeply nested temporal quantifiers . In the last layer , all object and time information is projected into a representation in the initial time step , which summarizes what takes place in the entire trajectory ( e.g. , the event “ the kicker eventually scores ” may be recognized at the first time step ) . We feed this representation into a final softmax unit , and get classification probabilities for the event that the network is trained to detect . Remark . It is important to understand the representational power of this model . The input transformation layer can be seen as defining basic predicates and relations that will be useful for defining more complex concepts , but no specific predicates or relations are built into it . The learned outputs might be properties that humans can interpret , such as “ moving fast ” or “ far from. ” The relational reasoning layers can build quantified expressions over these basic properties and relations , and might construct expressions that could be interpretable as “ the player is close to the ball. ” Finally , the temporal reasoning layer can represent temporal operations applied to these complex expressions , such as “ the player is close to the ball until the ball moves with high speed. ” Critically , none of the symbolic properties or predicates are hand defined—they are all constructed by the initial layer in order to enable the network to express the concept it is being trained on . Compared with the expressiveness of first-order linear temporal logic , TOQ-Nets only work in finite universes : all quantifiers only have finite interpretations . Meanwhile , the depth of the logical forms that it can learn is fixed . However , our goal is not to fully replicate temporal logic , but to bring ideas of object and temporal quantification into neural networks , and to use them as structural inductive biases to build models that generalize better from small amounts of data to situations with varying numbers of agents , objects , and time courses .
This paper proposes TOQ-Nets which is a structured neural network that learns to describe complex activities over entities and time. The model leverages relational reasoning layers which are the Neural Logic Machines (NLM) to capture the spatial information. To further capture the temporal information, this paper proposes temporal reasoning layers.The results show that their method outperforms conventional graph neural networks with high accuracy and generalization with a large margin.
SP:11763efc3e362e7b3a565f2c85e9eb1a03afda8f
Temporal and Object Quantification Nets
1 INTRODUCTION . When watching a soccer match ( Fig . 1 ) , we see more than just players and a ball moving around . Rather , we see events and actions in terms of high-level concepts , including relations between agents and objects . For example , people can easily recognize when one player has control of the ball , or when a player passed the ball to another player . This cognitive act is effortless , intuitive , and fast . Machines can recognize actions , too , but generally based on limited windows of space and time , and with weak generalization . Consider the variety of complicated spatio-temporal trajectories that passing can refer to ( Fig . 1 ) , and how an intelligent agent could learn this . The act of passing does not seem to be about the pixel-level specifics of the spatio-temporal trajectory . Rather , a pass is a high-level action-concept that is composed of other concepts , such as possession ( A pass begins with one player in possession of the ball and ends with another player in possession ) or kick . The concept of passing can itself be re-used in a compositional way , for example to distinguish between a short pass and a long pass . We propose Temporal and Object Quantification Nets ( TOQ-Nets ) , structured neural networks that learn to describe complex activities by quantifying over both entities and time . TOQ-Nets are motivated by the way in which humans perceive actions in terms of the properties of and relations between agents and objects , and the sequential structure of events ( Zacks et al. , 2007 ; Stränger & Hommel , 1996 ) . A TOQ-Net is a multi-layer neural network whose inputs are the properties of agents and objects and their relationships in a scene , which may change over time . In a soccer game , these inputs might be the 3D position of each player and the ball . Each layer in the TOQ-Net performs either object or temporal quantification , which can emulate and realize disjunctive and conjunctive quantification over the properties and relationships between entities , as in “ the kicker is behind all the other players ” , as well as quantification over time , as in “ the player controls the ball until it moves fast towards the goal. ” The key idea of TOQ-Nets is to use tensors to represent the relational features between agents and objects ( e.g. , the player controls the ball , and the ball is moving fast ) , and to use tensor pooling operations over different dimensions to realize temporal and object quantifiers ( all and until ) . Thus , by stacking these object and temporal quantification operations , TOQ-Nets can learn to construct higher-level concepts of actions based on the relations between entities over time , starting from low-level position and velocity input and supervised with only high-level class labels . We evaluate TOQ-Nets on two perceptually and conceptually different benchmarks for action recognition : trajectory-based soccer event detection and 6D pose-based manipulation concept learning . We show that the TOQ-Net makes several important contributions . First , TOQ-Nets outperform both convolutional and recurrent baselines for modeling relational-temporal concepts across both benchmarks . Second , by exploiting the temporal-relational features learned through supervised learning , TOQ-Nets achieve strong few-shot generalization to novel actions . Finally , TOQ-Nets exhibit strong generalization to scenarios where there are more agents and objects than were present during training . They are also robust w.r.t . time warped input trajectories . Meanwhile , the learned concepts can also be easily transferred to other prediction tasks in a similar domain . 2 RELATED WORK . Action concept representations and learning . TOQ-Nets impose a structural inductive bias that describes actions with quantification over objects ( every entity ... , there exists an entity ... ) and quantification over times ( an event happens until some time and then some other event begins ) , which is motivated by first-order and linear temporal logics ( Pnueli , 1977 ) . Such representations have been studied for analyzing sporting events ( Intille & Bobick , 1999 ; 2001 ) and daily actions ( Tran & Davis , 2008 ; Brendel et al. , 2011 ) using logic-based reasoning frameworks . However , these frameworks require extra knowledge to annotate relationships between low-level , primitive actions and complex ones . By contrast , TOQ-Nets enable end-to-end learning of complex action descriptions with only high-level action-class labels . Cognitive science has long recognized the importance of structural representations of actions and events in human reasoning , including in language , memory , perception , and development ( see e.g . Stränger & Hommel , 1996 ; Zacks et al. , 2001 ; 2007 ; Pinker , 2007 ; Baldwin et al. , 2001 ) . In this paper , we focus on the role of object and temporal quantification in learning action representations . Temporal and relational reasoning . This paper is also related to work on using neural networks and other data-driven models for modeling temporal structure . Early work includes ADL description languages ( Intille & Bobick , 1999 ; Zhuo et al. , 2019 ) , hidden Markov models ( Tang et al. , 2012 ) , and and-or graphs ( Gupta et al. , 2009 ; Tang et al. , 2013 ) . These models need human-annotated action descriptions ( e.g. , pick up x means a state transition from not holding x to holding x ) and specialpurpose inference algorithms such as graph structure learning algorithms . In contrast , TOQ-Nets have an end-to-end design and can be integrated with arbitrary differentiable modules such as convolutional neural networks . People have also used structural representations to model object-centric temporal concepts with temporal graph convolution networks ( Yan et al. , 2018 ; Materzynska et al. , 2020 ; Wang & Gupta , 2018 ; Ji et al. , 2020 ) . Meanwhile , Deng et al . ( 2016 ) proposed to integrate graph neural networks with RNNs by replacing the message aggregation step in GNN propagation with RNNs to capture temporal information . Bialkowski et al . ( 2014 ) ; Ibrahim et al . ( 2016 ) ) have proposed to build a personal-level and a group-level feature extractor for group activity recognition . The high-level idea is to use RNNs to encode per-person features across the video and use another RNN to combine features of individual persons into a group feature for every frame . StagNet Qi et al . ( 2018 ) and Spatial-Temporal Interaction Networks ( Materzynska et al. , 2020 ) combines graph neural networks with RNNs and spatial-temporal attention models to model temporal information . TOQ-Nets use a similar object-centric relational representation , but different models for temporal structures . There are also alternative models for temporal structures from pixels , such as convolutions ( Carreira & Zisserman , 2017 ; Ji et al. , 2020 ) , recurrent networks ( Dong et al. , 2019 ) , attention ( Wang et al. , 2018 ) , or segmentation consensus and its variants ( Wang et al. , 2016 ; Zhou et al. , 2018 ) . In contrast to these methods , TOQ-Nets works on an object-centric temporal-relational feature space , and uses the proposed temporal quantification operations to model the sequential structures of events . 3 TEMPORAL AND OBJECT QUANTIFICATION NETS . TOQ-Nets , shown in Fig . 2 , are multi-layer neural networks with a structural inductive bias for learning composable action concepts using object and temporal quantification . The input to a TOQNet is a tensor representation of the properties of all entities at each moment in time . For example , in a soccer game , the input encodes the position of each player and the ball , as well as the team membership of each player . The output is a label for the action performed by a target entity . The first layer of a TOQ-Net ( Fig . 2 ( i ) ) extracts temporal features for each entity with an input feature extractor that focuses on entity features within a fixed and local time window . These features may be computed by a convolutional neural network , such as STGCN ( Yan et al. , 2018 ) or a bank of parametric feature templates , such as thresholding the velocity of an entity : whether the velocity of an entity x is greater than a learnable parameter θ at time t. The output of this step is thus a collection of nullary , unary , and binary relational features over time for all entities . Throughout the paper we will assume that all output tensors of this layer are binary-valued , although the one can easily extend this feature extractor to any real-valued function . This input feature extractor is usually task- and dataset-specific and is not the main focus of this paper . Second , the temporal-relational features go through several relational reasoning layers , which we present in detail in Section 3.2 . In short , each layer at this step performs linear transformations , sigmoid activation , and object quantification operations . The linear and sigmoid functions allow the network to realize Boolean logical forms , and object quantification operators can realize quantifiers . With more relational reasoning layers , the network can realize logical forms with more quantifiers , as illustrated in Fig . 2 . All operators in these layers are performed for all time steps in parallel . Next , the relational reasoning layers summarize each event at a particular time step as a nullary feature that is passed to the to the temporal reasoning layer , as detailed in Section 3.3 . Each layer at this step performs linear transformations , sigmoid activation , and temporal quantification . They allow the model to realize logical forms in a simple linear temporal logic ( Pnueli , 1977 ) , such as always ∃x . q1 ( x ) ∧ q2 ( x ) . This is semantically equivalent to the temporally quantified expression ∀t . ∃x . q1 ( x , t ) ∧q2 ( x , t ) . Similar to the relational reasoning layers , adding more temporal reasoning layers enables the network to realize logical forms with more deeply nested temporal quantifiers . In the last layer , all object and time information is projected into a representation in the initial time step , which summarizes what takes place in the entire trajectory ( e.g. , the event “ the kicker eventually scores ” may be recognized at the first time step ) . We feed this representation into a final softmax unit , and get classification probabilities for the event that the network is trained to detect . Remark . It is important to understand the representational power of this model . The input transformation layer can be seen as defining basic predicates and relations that will be useful for defining more complex concepts , but no specific predicates or relations are built into it . The learned outputs might be properties that humans can interpret , such as “ moving fast ” or “ far from. ” The relational reasoning layers can build quantified expressions over these basic properties and relations , and might construct expressions that could be interpretable as “ the player is close to the ball. ” Finally , the temporal reasoning layer can represent temporal operations applied to these complex expressions , such as “ the player is close to the ball until the ball moves with high speed. ” Critically , none of the symbolic properties or predicates are hand defined—they are all constructed by the initial layer in order to enable the network to express the concept it is being trained on . Compared with the expressiveness of first-order linear temporal logic , TOQ-Nets only work in finite universes : all quantifiers only have finite interpretations . Meanwhile , the depth of the logical forms that it can learn is fixed . However , our goal is not to fully replicate temporal logic , but to bring ideas of object and temporal quantification into neural networks , and to use them as structural inductive biases to build models that generalize better from small amounts of data to situations with varying numbers of agents , objects , and time courses .
This paper overall presents a model that defines the multi-person activities using logic expressions and uses neural logic models to generate recognitions and predictions over events. Specifically, the model follows the neural logic machines (Dong et al.) to define the operations in the networks. Authors demonstrate their model under two tasks, trajectory-based soccer event detection, and robot object manipulation event understanding. Using their self-generated datasets from simulators, the authors found that their model performs better than other baselines.
SP:11763efc3e362e7b3a565f2c85e9eb1a03afda8f
Incorporating Symmetry into Deep Dynamics Models for Improved Generalization
1 INTRODUCTION . Modeling dynamical systems in order to forecast the future is of critical importance in a wide range of fields including , e.g. , fluid dynamics , epidemiology , economics , and neuroscience [ 2 ; 21 ; 45 ; 22 ; 14 ] . Many dynamical systems are described by systems of non-linear differential equations that are difficult to simulate numerically . Accurate numerical computation thus requires long run times and manual engineering in each application . Recently , there has been much work applying deep learning to accelerate solving differential equations [ 46 ; 6 ] . However , current approaches struggle with generalization . The underlying problem is that physical data has no canonical frame of reference to use for data normalization . For example , it is not clear how to rotate samples of fluid flow such that they share a common orientation . Thus real-world out-of-distribution test data is difficult to align with training data . Another limitation of current approaches is low physical accuracy . Even when mean error is low , errors are often spatially correlated , producing a different energy distribution from the ground truth . We propose to improve the generalization and physical accuracy of deep learning models for physical dynamics by incorporating symmetries into the forecasting model . In physics , Noether ’ s Law gives a correspondence between conserved quantities and groups of symmetries . By building a neural network which inherently respects a given symmetry , we thus make conservation of the associated quantity more likely and consequently the model ’ s prediction more physically accurate . ∗Equal contribution A function f is equivariant if when its input x is transformed by a symmetry group g , the output is transformed by the same symmetry , f ( g · x ) = g · f ( x ) . See Figure 1 for an illustration . In the setting of forecasting , f approximates the underlying dynamical system . The set of valid transformations g is called the symmetry group of the system . Figure 1 : Illustration of equivariance of e.g . f ( x ) = 2x with respect to T = rot ( π/4 ) . By designing a model that is inherently equivariant to transformations of its input , we can guarantee that our model generalizes automatically across these transformations , making it robust to distributional shift . The symmetries we consider , translation , rotation , uniform motion , and scale , have different properties , and thus we tailor our methods for incorporating each symmetry . Specifically , for scale equivariance , we replace the convolution operation with group correlation over the group G generated by translations and rescalings . Our method builds on that of Worrall and Welling [ 51 ] , with significant novel adaptations to the physics domain : scaling affecting time , space , and magnitude ; both up and down scaling ; and scaling by any real number . For rotational symmetries , we leverage the key insight of Cohen and Welling [ 9 ] that the input , output , and hidden layers of the network are all acted upon by the symmetry group and thus should be treated as representations of the symmetry group . Our rotation-equivariant model is built using the flexible E ( 2 ) -CNN framework developed by Weiler and Cesa [ 49 ] . In the case of a uniform motion , or Galilean transformation , we show the above methods are too constrained . We use the simple but effective technique of convolutions conjugated by averaging operations . Research into equivariant neural networks has mostly been applied to tasks such as image classification and segmentation [ 27 ; 50 ; 49 ] . In contrast , we design equivariant networks in a completely different context , that of a time series representing a physical process . Forecasting high-dimensional turbulence is a significant step for equivariant neural networks compared to the low-dimensional physics examples and computer vision problems treated in other works . We test on a simulated turbulent convection dataset and on real-world ocean current and temperature data . Ocean currents are difficult to predict using numerical methods due to unknown external forces and complex dynamics not fully captured by simplified mathematical models . These domains are chosen as examples , but since the symmetries we focus on are pervasive in almost all physics problems , we expect our techniques will be widely applicable . Our contributions include : • We study the problem of improving the generalization capability and physical accuracy of deep learning models for learning complex physical dynamics such as turbulence and ocean currents . • We design tailored methods with theoretical guarantees to incorporate various symmetries , including uniform motion , rotation , and scaling , into convolutional neural networks . • When evaluated on turbulent convection and ocean current prediction , our models achieve significant improvement on generalization of both predictions and physical consistency . • For different symmetries , our methods have an average 31 % and maximum 78 % reduction in energy error when evaluated on turbulent convection with no distributional shift . 2 MATHEMATICAL PRELIMINARIES . 2.1 SYMMETRY GROUPS AND EQUIVARIANT FUNCTIONS . Formal discussion of symmetry relies on the concept of an abstract symmetry group . We give a brief overview , for a more formal treatment see Appendix A , or Lang [ 28 ] . A group of symmetries or simply group consists of a set G together with a composition map ◦ : G×G→ G. The composition map is required to be associative and have an identity 1 ∈ G. Most importantly , composition with any element of G is required to be invertible . Groups are abstract objects , but they become concrete when we let them act . A group G has an action on a set S if there is an action map · : G× S → S which is compatible with the composition law . We say further that S is a G-representation if the set S is a vector space and the group acts on S by linear transformations . Definition 1 ( invariant , equivariant ) . Let f : X → Y be a function and G be a group . Assume G acts on X and Y . The function f is G-equivariant if f ( gx ) = gf ( x ) for all x ∈ X and g ∈ G. The function f is G-invariant if f ( gx ) = f ( x ) for all x ∈ X and g ∈ G . 2.2 PHYSICAL DYNAMICAL SYSTEMS . We investigate two dynamical systems : Rayleigh–Bénard convection and real-world ocean current and temperature . These systems are governed by Navier-Stokes equations . 2D Navier-Stokes ( NS ) Equations . Let w ( x , t ) be the velocity vector field of a flow . The field w has two components ( u , v ) , velocities along the x and y directions . The governing equations for this physical system are the momentum equation , continuity equation , and temperature equation , ∂w ∂t = − ( w · ∇ ) w − 1 ρ0 ∇p+ ν∇2w + f ; ∇ ·w = 0 ; ∂H ∂t = κ∆H − ( w · ∇ ) H , ( DNS ) where H ( x , t ) is temperature , p is pressure , κ is the heat conductivity , ρ0 is initial density , α is the coefficient of thermal expansion , ν is the kinematic viscosity , and f is the buoyant force . 2.3 SYMMETRIES OF DIFFERENTIAL EQUATIONS . By classifying the symmetries of a system of differential equations , the task of finding solutions is made far simpler , since the space of solutions will exhibit those same symmetries . Let G be a group equipped with an action on 2-dimensional space X = R2 and 3-dimensional spacetime X̂ = R3 . Let V = Rd be a G-representation . Denote the set of all V -fields on X̂ as F̂V = { w : X̂ → V : w smooth } . Define FV similarly to be V -fields on X . Then G has an induced action on F̂V by ( gw ) ( x , t ) = g ( w ( g−1x , g−1t ) ) and on FV analogously . Consider a system of differential operatorsD acting on F̂V . Denote the set of solutions Sol ( D ) ⊆ F̂V . We sayG is a symmetry group ofD ifG preserves Sol ( D ) . That is , ifϕ is a solution ofD , then for all g ∈ G , g ( ϕ ) is also . In order to forecast the evolution of a systemD , we model the forward prediction function f . Let w ∈ Sol ( D ) . The input to f is a collection of k snapshots at times t− k , . . . , t− 1 denoted wt−i ∈ Fd . The prediction function f : Fkd → Fd is defined f ( wt−k , . . . , wt−1 ) = wt . It predicts the solution at a time t based on the solution in the past . Let G be a symmetry group of D. Then for g ∈ G , g ( w ) is also a solution of D. Thus f ( gwt−k , . . . , gwt−1 ) = gwt . Consequently , f is G-equivariant . 2.4 SYMMETRIES OF NAVIER-STOKES EQUATIONS . The Navier-Stokes equations are invariant under the following five different transformations . Individually each of these types of transformations generates a group of symmetries of the system . The full list of symmetry groups of NS equations and Heat equations are shown in Appendix B.6 . • Space translation : T spc w ( x , t ) = w ( x− c , t ) , c ∈ R2 , • Time translation : T timeτ w ( x , t ) = w ( x , t− τ ) , τ ∈ R , • Uniform motion : T umc w ( x , t ) = w ( x , t ) + c , c ∈ R2 , • Rotation/Reflection : T rotR w ( x , t ) = Rw ( R−1x , t ) , R ∈ O ( 2 ) , • Scaling : T scλ w ( x , t ) = λw ( λx , λ2t ) , λ ∈ R > 0 . 3 METHODOLOGY . We prescribe equivariance by training within function classes containing only equivariant functions . Our models can thus be theoretically guaranteed to be equivariant up to discretization error . We incorporate equivariance into two state-of-the-art architectures for dynamics prediction , ResNet and U-net [ 48 ] . Below , we describe how we modify the convolution operation in these models for different symmetries G to form four EquG-ResNet and four EquG-Unet models . 3.1 EQUIVARIANT NETWORKS . The key to building equivariant networks is that the composition of equivariant functions is equivariant . Hence , if the maps between layers of a neural network are equivariant , then the whole network will be equivariant . Note that both the linear maps and activation functions must be equivariant . An important consequence of this principle is that the hidden layers must also carry a G-action . Thus , the hidden layers are not collections of scalar channels , but vector-valued G-representations . Equivariant Convolutions . Consider a convolutional layer FRdin → FRdout with kernel K from a Rdin-field to a Rdout-field . Let Rdin and Rdout be G-representations with action maps ρin and ρout respectively . Cohen et al . [ 11 , Theorem 3.3 ] prove the network is G-equivariant if and only if K ( gv ) = ρ−1out ( g ) K ( v ) ρin ( g ) for all g ∈ G. ( 1 ) A network composed of such equivariant convolutions is called a steerable CNN . Equivariant ResNet and U-net . Equivariant ResNet architectures appear in [ 9 ; 10 ] , and equivariant transposed convolution , a feature of U-net , is implemented in [ 49 ] . We prove in general that adding skip connections to a network does not affect its equivariance with respect to linear actions and also give a condition for ResNet or Unet to be equivariant in Appendix B.2 . Relation to Data Augmentation . To improve generalization , equivariant networks offer a better performing alternative to the popular technique of data augmentation [ 13 ] . Large symmetry groups normally require augmentation with many transformed examples . In contrast , for equivariant models , we have following proposition . ( See Appendix B.1 for proof . ) Proposition 1 . G-equivariant models with equivariant loss learn equally ( up to sample weight ) from any transformation g ( s ) of a sample s. Thus data augmentation does not help during training .
The paper demonstrates that incorporating equivariance (i.e. symmetries) into model for predicting fluid dynamics improves its performance, especially when the test distribution is transformed by those symmetry groups. Leveraging the recent literature on equivariant CNNs, the paper proposes a CNN model that is equivariant with respect to known symmetries of the Navier-Stokes equations (time/space translation, rotation, uniform motion, and scaling). This approached is validated on 2 datasets on fluid dynamics: a synthetic dataset on Rayleigh-Benard convection and a real-world ocean dynamics dataset. On the synthetic dataset, the proposed models demonstrate better performance under distribution shift. On the real-world dataset, the models yields predictions that are more accurate and physically consistent.
SP:d39fbf20324d392c4b0cbbf7fc40451d38285e6f
Incorporating Symmetry into Deep Dynamics Models for Improved Generalization
1 INTRODUCTION . Modeling dynamical systems in order to forecast the future is of critical importance in a wide range of fields including , e.g. , fluid dynamics , epidemiology , economics , and neuroscience [ 2 ; 21 ; 45 ; 22 ; 14 ] . Many dynamical systems are described by systems of non-linear differential equations that are difficult to simulate numerically . Accurate numerical computation thus requires long run times and manual engineering in each application . Recently , there has been much work applying deep learning to accelerate solving differential equations [ 46 ; 6 ] . However , current approaches struggle with generalization . The underlying problem is that physical data has no canonical frame of reference to use for data normalization . For example , it is not clear how to rotate samples of fluid flow such that they share a common orientation . Thus real-world out-of-distribution test data is difficult to align with training data . Another limitation of current approaches is low physical accuracy . Even when mean error is low , errors are often spatially correlated , producing a different energy distribution from the ground truth . We propose to improve the generalization and physical accuracy of deep learning models for physical dynamics by incorporating symmetries into the forecasting model . In physics , Noether ’ s Law gives a correspondence between conserved quantities and groups of symmetries . By building a neural network which inherently respects a given symmetry , we thus make conservation of the associated quantity more likely and consequently the model ’ s prediction more physically accurate . ∗Equal contribution A function f is equivariant if when its input x is transformed by a symmetry group g , the output is transformed by the same symmetry , f ( g · x ) = g · f ( x ) . See Figure 1 for an illustration . In the setting of forecasting , f approximates the underlying dynamical system . The set of valid transformations g is called the symmetry group of the system . Figure 1 : Illustration of equivariance of e.g . f ( x ) = 2x with respect to T = rot ( π/4 ) . By designing a model that is inherently equivariant to transformations of its input , we can guarantee that our model generalizes automatically across these transformations , making it robust to distributional shift . The symmetries we consider , translation , rotation , uniform motion , and scale , have different properties , and thus we tailor our methods for incorporating each symmetry . Specifically , for scale equivariance , we replace the convolution operation with group correlation over the group G generated by translations and rescalings . Our method builds on that of Worrall and Welling [ 51 ] , with significant novel adaptations to the physics domain : scaling affecting time , space , and magnitude ; both up and down scaling ; and scaling by any real number . For rotational symmetries , we leverage the key insight of Cohen and Welling [ 9 ] that the input , output , and hidden layers of the network are all acted upon by the symmetry group and thus should be treated as representations of the symmetry group . Our rotation-equivariant model is built using the flexible E ( 2 ) -CNN framework developed by Weiler and Cesa [ 49 ] . In the case of a uniform motion , or Galilean transformation , we show the above methods are too constrained . We use the simple but effective technique of convolutions conjugated by averaging operations . Research into equivariant neural networks has mostly been applied to tasks such as image classification and segmentation [ 27 ; 50 ; 49 ] . In contrast , we design equivariant networks in a completely different context , that of a time series representing a physical process . Forecasting high-dimensional turbulence is a significant step for equivariant neural networks compared to the low-dimensional physics examples and computer vision problems treated in other works . We test on a simulated turbulent convection dataset and on real-world ocean current and temperature data . Ocean currents are difficult to predict using numerical methods due to unknown external forces and complex dynamics not fully captured by simplified mathematical models . These domains are chosen as examples , but since the symmetries we focus on are pervasive in almost all physics problems , we expect our techniques will be widely applicable . Our contributions include : • We study the problem of improving the generalization capability and physical accuracy of deep learning models for learning complex physical dynamics such as turbulence and ocean currents . • We design tailored methods with theoretical guarantees to incorporate various symmetries , including uniform motion , rotation , and scaling , into convolutional neural networks . • When evaluated on turbulent convection and ocean current prediction , our models achieve significant improvement on generalization of both predictions and physical consistency . • For different symmetries , our methods have an average 31 % and maximum 78 % reduction in energy error when evaluated on turbulent convection with no distributional shift . 2 MATHEMATICAL PRELIMINARIES . 2.1 SYMMETRY GROUPS AND EQUIVARIANT FUNCTIONS . Formal discussion of symmetry relies on the concept of an abstract symmetry group . We give a brief overview , for a more formal treatment see Appendix A , or Lang [ 28 ] . A group of symmetries or simply group consists of a set G together with a composition map ◦ : G×G→ G. The composition map is required to be associative and have an identity 1 ∈ G. Most importantly , composition with any element of G is required to be invertible . Groups are abstract objects , but they become concrete when we let them act . A group G has an action on a set S if there is an action map · : G× S → S which is compatible with the composition law . We say further that S is a G-representation if the set S is a vector space and the group acts on S by linear transformations . Definition 1 ( invariant , equivariant ) . Let f : X → Y be a function and G be a group . Assume G acts on X and Y . The function f is G-equivariant if f ( gx ) = gf ( x ) for all x ∈ X and g ∈ G. The function f is G-invariant if f ( gx ) = f ( x ) for all x ∈ X and g ∈ G . 2.2 PHYSICAL DYNAMICAL SYSTEMS . We investigate two dynamical systems : Rayleigh–Bénard convection and real-world ocean current and temperature . These systems are governed by Navier-Stokes equations . 2D Navier-Stokes ( NS ) Equations . Let w ( x , t ) be the velocity vector field of a flow . The field w has two components ( u , v ) , velocities along the x and y directions . The governing equations for this physical system are the momentum equation , continuity equation , and temperature equation , ∂w ∂t = − ( w · ∇ ) w − 1 ρ0 ∇p+ ν∇2w + f ; ∇ ·w = 0 ; ∂H ∂t = κ∆H − ( w · ∇ ) H , ( DNS ) where H ( x , t ) is temperature , p is pressure , κ is the heat conductivity , ρ0 is initial density , α is the coefficient of thermal expansion , ν is the kinematic viscosity , and f is the buoyant force . 2.3 SYMMETRIES OF DIFFERENTIAL EQUATIONS . By classifying the symmetries of a system of differential equations , the task of finding solutions is made far simpler , since the space of solutions will exhibit those same symmetries . Let G be a group equipped with an action on 2-dimensional space X = R2 and 3-dimensional spacetime X̂ = R3 . Let V = Rd be a G-representation . Denote the set of all V -fields on X̂ as F̂V = { w : X̂ → V : w smooth } . Define FV similarly to be V -fields on X . Then G has an induced action on F̂V by ( gw ) ( x , t ) = g ( w ( g−1x , g−1t ) ) and on FV analogously . Consider a system of differential operatorsD acting on F̂V . Denote the set of solutions Sol ( D ) ⊆ F̂V . We sayG is a symmetry group ofD ifG preserves Sol ( D ) . That is , ifϕ is a solution ofD , then for all g ∈ G , g ( ϕ ) is also . In order to forecast the evolution of a systemD , we model the forward prediction function f . Let w ∈ Sol ( D ) . The input to f is a collection of k snapshots at times t− k , . . . , t− 1 denoted wt−i ∈ Fd . The prediction function f : Fkd → Fd is defined f ( wt−k , . . . , wt−1 ) = wt . It predicts the solution at a time t based on the solution in the past . Let G be a symmetry group of D. Then for g ∈ G , g ( w ) is also a solution of D. Thus f ( gwt−k , . . . , gwt−1 ) = gwt . Consequently , f is G-equivariant . 2.4 SYMMETRIES OF NAVIER-STOKES EQUATIONS . The Navier-Stokes equations are invariant under the following five different transformations . Individually each of these types of transformations generates a group of symmetries of the system . The full list of symmetry groups of NS equations and Heat equations are shown in Appendix B.6 . • Space translation : T spc w ( x , t ) = w ( x− c , t ) , c ∈ R2 , • Time translation : T timeτ w ( x , t ) = w ( x , t− τ ) , τ ∈ R , • Uniform motion : T umc w ( x , t ) = w ( x , t ) + c , c ∈ R2 , • Rotation/Reflection : T rotR w ( x , t ) = Rw ( R−1x , t ) , R ∈ O ( 2 ) , • Scaling : T scλ w ( x , t ) = λw ( λx , λ2t ) , λ ∈ R > 0 . 3 METHODOLOGY . We prescribe equivariance by training within function classes containing only equivariant functions . Our models can thus be theoretically guaranteed to be equivariant up to discretization error . We incorporate equivariance into two state-of-the-art architectures for dynamics prediction , ResNet and U-net [ 48 ] . Below , we describe how we modify the convolution operation in these models for different symmetries G to form four EquG-ResNet and four EquG-Unet models . 3.1 EQUIVARIANT NETWORKS . The key to building equivariant networks is that the composition of equivariant functions is equivariant . Hence , if the maps between layers of a neural network are equivariant , then the whole network will be equivariant . Note that both the linear maps and activation functions must be equivariant . An important consequence of this principle is that the hidden layers must also carry a G-action . Thus , the hidden layers are not collections of scalar channels , but vector-valued G-representations . Equivariant Convolutions . Consider a convolutional layer FRdin → FRdout with kernel K from a Rdin-field to a Rdout-field . Let Rdin and Rdout be G-representations with action maps ρin and ρout respectively . Cohen et al . [ 11 , Theorem 3.3 ] prove the network is G-equivariant if and only if K ( gv ) = ρ−1out ( g ) K ( v ) ρin ( g ) for all g ∈ G. ( 1 ) A network composed of such equivariant convolutions is called a steerable CNN . Equivariant ResNet and U-net . Equivariant ResNet architectures appear in [ 9 ; 10 ] , and equivariant transposed convolution , a feature of U-net , is implemented in [ 49 ] . We prove in general that adding skip connections to a network does not affect its equivariance with respect to linear actions and also give a condition for ResNet or Unet to be equivariant in Appendix B.2 . Relation to Data Augmentation . To improve generalization , equivariant networks offer a better performing alternative to the popular technique of data augmentation [ 13 ] . Large symmetry groups normally require augmentation with many transformed examples . In contrast , for equivariant models , we have following proposition . ( See Appendix B.1 for proof . ) Proposition 1 . G-equivariant models with equivariant loss learn equally ( up to sample weight ) from any transformation g ( s ) of a sample s. Thus data augmentation does not help during training .
This paper studies improving the modeling of physical dynamics with equivariant neural networks. In particular, this paper focuses on a new type of data governed by physical models. Several special symmetry groups are considered to better characterize the system, including uniform motion equivariance, resolution-independent scaling, and resolution-dependent scaling, etc. Simulation results show that the proposed equivariant model yields better accuracy and physical consistency than the non-equivariant models even with data augmentation, given the type of distributional shift is known. Results on the real-world data show some of the equivariant models can generalize better than the non-equivariant models.
SP:d39fbf20324d392c4b0cbbf7fc40451d38285e6f
Adam$^+$: A Stochastic Method with Adaptive Variance Reduction
1 INTRODUCTION . Adaptive gradient methods ( Duchi et al. , 2011 ; McMahan & Streeter , 2010 ; Tieleman & Hinton , 2012 ; Kingma & Ba , 2014 ; Reddi et al. , 2019 ) are one of the most important variants of Stochastic Gradient Descent ( SGD ) in modern machine learning applications . Contrary to SGD , adaptive gradient methods typically require little parameter tuning still retaining the computational efficiency of SGD . One of the most used adaptive methods is Adam ( Kingma & Ba , 2014 ) , which is considered by practitioners as the de-facto default optimizer for deep learning frameworks . Adam computes the update for every dimension of the model parameter through a moment estimation , i.e. , the estimates of the first and second moments of the gradients . The estimates for first and second moments are updated using exponential moving averages with two different control parameters . These moving averages are the key difference between Adam and previous adaptive gradient methods , such as Adagrad ( Duchi et al. , 2011 ) . Although Adam exhibits great empirical performance , there still remain many mysteries about its convergence . First , it has been shown that Adam may not converge for some objective functions ( Reddi et al. , 2019 ; Chen et al. , 2018b ) . Second , it is unclear what is the benefit that the moving average brings from theoretical point of view , especially its effect on the convergence rate . Third , it has been empirically observed that adaptive gradient methods can have worse generalization performance than its non-adaptive counterpart ( e.g. , SGD ) on various deep learning tasks due to the coordinate-wise learning rates ( Wilson et al. , 2017 ) . The above issues motivate us to design a new algorithm which achieves the best of both worlds , i.e. , provable convergence with benefits from the moving average and enjoying good generalization performance in deep learning . Specifically , we focus on the following optimization problem : min w∈Rd F ( w ) , where we only have access to stochastic gradients of F . Note that F could possibly be nonconvex in w. Due to the non-convexity , our goal is to design a stochastic first-order algorithm to find the -stationary point , i.e. , finding w such that E [ ‖∇F ( w ) ‖ ] ≤ , with low iteration complexity . Our key contribution is the design and analysis of a new stochastic method named Adam+ . Adam+ retains some of the key components of Adam but it also has several noticeable differences : ( i ) it does not maintain the moving average of second moment estimate but instead computes the moving average of first moment estimate at extrapolated points ; ( ii ) its adaptive step size is formed not by dividing the square root of coordinate-wise second moment estimate but instead by dividing the root of the norm of first moment estimate . These features allow us to establish the adaptive convergence of Adam+ . Different from existing adaptive methods where the adaptive convergence depends on the growth rate of stochastic gradients ( Duchi et al. , 2011 ; McMahan & Streeter , 2010 ; Kingma & Ba , 2014 ; Luo et al. , 2019 ; Reddi et al. , 2019 ; Chen et al. , 2018a ; b ; Ward et al. , 2019 ; Li & Orabona , 2019 ; Chen et al. , 2019 ) , our adaptive convergence is due to the adaptive variance reduction property of our first order moment estimate . In existing literature , the variance reduction is usually achieved by large mini-batch ( Goyal et al. , 2017 ) or recursive variance reduction ( Fang et al. , 2018 ; Zhou et al. , 2018 ; Pham et al. , 2020 ; Cutkosky & Orabona , 2019 ) . In contrast , we do not necessarily require large minibatch or computing stochastic gradients at two points per-iteration to achieve the variance reduction . In addition , we also establish a fast rate that matches the state-of-theart complexity under the same conditions of a variant of Adam+ . Table 1 provides an overview of our results and a summary of existing results . We refer readers to Section F for a comprehensive survey of other related work . We further corroborate our theoretical results with an extensive empirical study on various deep learning tasks . Our contributions are summarized below . • We propose a new algorithm with adaptive step size , namely Adam+ , for general nonconvex optimization . We show that it enjoys a new type of data-dependent adaptive convergence that depends on the variance reduction property of first moment estimate . Notably , this data-dependent complexity does not require the presence of sparsity in stochastic gradients to guarantee fast convergence as in previous works ( Duchi et al. , 2011 ; Kingma & Ba , 2014 ; Reddi et al. , 2019 ; Chen et al. , 2019 ; 2018a ) . To the best of our knowledge , this is the first work establishing such new type of data-dependent complexity . • We show that a general variant of our algorithm can achieve O ( −3.5 ) worst-case complexity , which matches the state-of-the-art complexity guarantee under the Hessian Lipschitz assumption ( Cutkosky & Mehta , 2020 ) . • We demonstrate the effectiveness of our algorithms on image classification , language modeling , and automatic speech recognition . Our empirical results show that our proposed algorithm consistently outperforms Adam on all tasks , and it achieves comparable performance with the best-tuned SGD and momentum SGD . Algorithm 1 Adam+ : Good default settings for the tested machine learning problems are α = 0.1 , a = 1 , β = 0.1 , 0 = 10−8 . 1 : Require : α , a ≥ 1 : stepsize parameters 2 : Require : β ∈ ( 0 , 1 ) : Exponential decay rates for the moment estimate 3 : Require : gt ( w ) : unbiased stochastic gradient with parameters w at iteration t 4 : Require : w0 : Initial parameter vector 5 : z0 = g0 ( w0 ) 6 : for t = 0 , . . . , T do 7 : Set ηt = αβ a max ( ‖zt‖1/2 , 0 ) 8 : wt+1 = wt − ηtzt 9 : ŵt+1 = ( 1− 1/β ) wt + 1/β ·wt+1 10 : zt+1 = ( 1− β ) zt + βgt+1 ( ŵt+1 ) 11 : end for 2 ALGORITHM AND THEORETICAL ANALYSIS . In this section , we introduce our algorithm Adam+ ( presented in Algorithm 1 ) and establish its convergence guarantees . Adam+ resembles Adam in several aspects but also has noticeable differences . Similar to Adam , Adam+ also maintains an exponential moving average of first moment ( i.e. , stochastic gradient ) , which is denoted by zt , and uses it for updating the solution in line 8 . However , the difference is that the stochastic gradient is evaluated on an extrapolated data point ŵt+1 , which is an extrapolation of two previous updates wt and wt+1 . Similar to Adam , Adam+ also uses an adaptive step size that is proportional to 1/‖zt‖1/2 . Nonetheless , the difference lies at its adaptive step size is directly computed from the square root of the norm of first moment estimate zt . In contrast , Adam uses an adaptive step size that is proportional to 1/ √ vt , where vt is an exponential moving average of second moment estimate . These two key components of Adam+ , i.e. , extrapolation and adaptive step size from the root norm of the first moment estimate , make it enjoy two noticeable benefits : variance reduction of first moment estimate and adaptive convergence . We shall explain these two benefits later . Before moving to the theoretical analysis , we would like to make some remarks . First , it is worth mentioning that the moving average estimate with extrapolation is inspired by the literature of stochastic compositional optimization ( Wang et al. , 2017 ) . Wang et al . ( 2017 ) showed that the extrapolation helps balancing the noise in the gradients , reducing the bias in the estimates and giving a faster convergence rate . Here , our focus and analysis techniques are quite different . In fact , Wang et al . ( 2017 ) focuses on the compositional optimization while we consider a general nonconvex optimization setting . Moreover , the analysis in ( Wang et al. , 2017 ) mainly deals with the error of the gradient estimator caused by the compositional nature of the problem , while our analysis focuses on carefully designing adaptive normalization to obtain an adaptive and fast convergence rates . A similar extrapolation scheme has been also employed in the algorithm NIGT by Cutkosky & Mehta ( 2020 ) . In later sections , we will also provide a more general variant of Adam+ which subsumes NIGT as a special case . Another important remark is that the update of Adam+ is very different from the famous Nesterov ’ s momentum method . In Nesterov ’ s momentum method , the update of wt+1 uses the stochastic gradient at an extrapolated point ŵt+1 = wt+1 +γ ( wt+1−wt ) with a momentum parameter γ ∈ ( 0 , 1 ) . In contrast , in Adam+ the update of wt+1 is using the moving average estimate at an extrapolated point ŵt+1 = wt+1 + ( 1/β − 1 ) ( wt+1 −wt ) . Finally , Adam+ does not employ coordinate-wise learning rates as in Adam , and hence it is expected to have better generalization performance according to Wilson et al . ( 2017 ) . 2.1 ADAPTIVE VARIANCE REDUCTION AND ADAPTIVE CONVERGENCE . In this subsection , we analyze Adam+ by showing its variance reduction property and adaptive convergence . To this end , we make the following assumptions . Assumption 1 . There exists positive constants L , ∆ , LH , σ and an initial solution w0 such that ( i ) F is L-smooth , i.e. , ‖∇F ( x ) −∇F ( y ) ‖ ≤ L ‖x− y‖ , ∀x , y ∈ Rd . ( ii ) For ∀x ∈ Rd , we have access to a first-order stochastic oracle at time t gt ( x ) such that E [ gt ( x ) ] = ∇F ( x ) , E ‖gt ( x ) −∇F ( x ) ‖2 ≤ σ2 . ( iii ) ∇F is a LH -smooth mapping , i.e. , ‖∇2F ( x ) −∇2F ( y ) ‖ ≤ LH‖x− y‖ , ∀x , y ∈ Rd . ( iv ) F ( w0 ) − F∗ ≤ ∆ < ∞ , where F∗ = infw∈Rd F ( w ) . Remark : Assumption 1 ( i ) and ( ii ) , ( iv ) are standard assumptions made in literature of stochastic non-convex optimization ( Ghadimi & Lan , 2013 ) . Assumption ( iii ) is the assumption that deviates from typical analysis of stochastic methods . We leverage this assumption to explore the benefit of moving average , extrapolation and adaptive normalization . It is also used in some previous works for establishing fast rate of stochastic first-order methods for nonconvex optimization ( Fang et al. , 2019 ; Cutkosky & Mehta , 2020 ) and this assumption is essential to get fast rate due to the hardness result in ( Arjevani et al. , 2019 ) . It is also the key assumption for finding a local minimum in previous works ( Carmon et al. , 2018 ; Agarwal et al. , 2017 ; Jin et al. , 2017 ) . We might also assume that the stochastic gradient estimator in Algorithm 1 satisfies the following variance property . Assumption 2 . Assume that E [ ‖g0 ( w0 ) − ∇F ( w0 ) ‖2 ] ≤ σ20 and E [ ‖gt ( wt ) − ∇F ( wt ) ‖2 ] ≤ σ2m , t ≥ 1 . Remark : When g0 ( resp . gt ) is implemented by a mini-batch stochastic gradient with mini-batch size S , then σ20 ( resp . σ 2 m ) can be set as σ 2/S by Assumption 1 ( ii ) . We differentiate the initial variance and intermediate variance because they contribute differently to the convergence . We first introduce a lemma to characterize the variance of the moving average gradient estimator zt . Lemma 1 . Suppose Assumption 1 and Assumption 2 hold and a ≥ 1 . Then , there exists a sequence of random variables δt satisfying ‖zt −∇F ( wt ) ‖ ≤ δt for ∀t ≥ 0 , E [ δ2t+1 ] ≤ ( 1− β 2 ) E [ δ2t ] + 2β2σ2m + E [ CL2H‖wt+1 −wt‖4 β3 ] ≤ ( 1− β 2 ) E [ δ2t ] + 2β2σ2m + E [ CL2Hα 4β4a−3‖zt‖2 ] , where C = 1944 . Remark : Note that δt is an upper bound of ‖zt − ∇F ( wt ) ‖ , the above lemma can be used to illustrate the variance reduction effect for the gradient estimator zt . To this end , we can bound ‖zt‖2 ≤ 2δ2t + 2‖∇F ( wt ) ‖2 , then the term CL2α4β4a−3δ2t can be canceled with −β/4δ2t with small enough α . Hence , we have Eδ2t+1 ≤ ( 1 − β/4 ) E [ δ2t ] + 2β2σ2m + cE [ ‖∇F ( wt ) ‖2 ] with a small constant c. As the algorithm converges with E [ ‖∇F ( wt ) ‖2 ] and β decreases to zero , the variance of zt will also decrease . Indeed , the above recursion of zt ’ s variance resembles that of the recursive variance reduced gradient estimators ( e.g. , SPIDER ( Fang et al. , 2018 ) , STORM ( Cutkosky & Orabona , 2019 ) ) . The benefit of using Adam+ is that we do not need to compute stochastic gradient twice at each iteration . We can now state our convergence rates for Algorithm 1 . Theorem 1 . Suppose Assumption 1 and Assumption 2 hold . Suppose ‖∇F ( w ) ‖ ≤ G for any w ∈ Rd . By choosing the parameters such that α4 ≤ 1 36CL2H , α ≤ 14L , a = 1 and 0 = β a , we have 1 T T∑ t=1 E ‖∇F ( wt ) ‖2 ≤ GE [ ∑T t=1 ‖zt‖ ] T + ∆ αT + 18σ20 βT + 30βσ2m . ( 1 ) In addition , suppose the initial batch size is T0 and the intermediate batch size is m , and choose β = T−b with 0 ≤ b ≤ 1 , we have 1 T T∑ t=1 E ‖∇F ( wt ) ‖2 ≤ E [ G ∑T t=1 ‖zt‖ ] T + ∆ αT + 18σ2 T 1−bT0 + 30σ2 mT b . ( 2 ) Theorem 2 . Suppose Assumption 1 and Assumption 2 hold . By choosing parameters such that 640α3L 3/2 H ≤ 1/120 , a = 1 , 0 = 0 , β = 1/T s with s = 2/3 then it takes T = O ( −4.5 ) number of iterations to ensure that 1 T T∑ t=1 E [ ‖∇F ( wt ) ‖3/2 ] ≤ 3/2 , 1 T E [ T∑ t=1 δ 3/2 t ] ≤ 3/2 . Remarks : • From Theorem 1 , we can observe that the convergence rate of Adam+ crucially depends on the growth rate of E [ ∑T t=1 ‖zt‖ ] , which gives a data-dependent adaptive complexity . If E [ ∑T t=1 ‖zt‖ ] ≤ Tα with α < 1 , then the algorithm converges . Smaller α implies faster convergence . Our goal is to ensure that 1T ∑T t=1 E‖∇F ( wt ) ‖2 ≤ 2 . Choosing b = 1−α , m = O ( 1 ) and T0 = T 1−α = O ( −2 ) , and we end up with T = O ( − 2 1−α ) complexity . • Theorem 2 shows that in the ergodic sense , the Algorithm Adam+ always converges , and the variance gets smaller when the number of iteration gets larger . Theorem 2 rules out the case that the magnitude of zt converges to a constant and the bound ( 2 ) in Theorem 1 becomes vacuous . • To compare with Adam-style algorithms ( e.g. , Adam , AdaGrad ) , these algorithms ’ convergence depend on the growth rate of stochastic gradient , i.e. , ∑d i=1 ‖g1 : T , i‖/T , where g1 : T , i = [ g1 , i , . . . , gT , i ] denotes the i-th coordinate of all historical stochastic gradients . Hence , the data determines the growth rate of stochastic gradient . If the stochastic gradients are not sparse , then its growth rate may not be slow and these Adam-style algorithms may suffer from slow convergence . In contrast , for Adam+ the convergence can be accelerated by the variance reduction property . Note that we have E [ ∑T t=1 ‖zt‖ ] /T ≤ E [ ∑T t=1 ( δt + ‖∇F ( wt ) ‖ ) ] /T . Hence , Adam+ ’ s convergence depends on the variance reduction property of zt . 2.2 A GENERAL VARIANT OF ADAM+ : FAST CONVERGENCE WITH LARGE MINI-BATCH Next , we introduce a more general variant of Adam+ by making a simple change . In particular , we keep all steps the same as in Algorithm 1 except the adaptive step size is now set as ηt = αβa max ( ‖zt‖p , 0 ) , where p ∈ [ 1/2 , 1 ) is parameter . We refer to this general variant of Adam + as power normalized Adam+ ( Nadam+ ) . This generalization allows us to compare with some existing methods and to establish fast convergence rate . First , we notice that when setting p = 1 and a = 5/4 and β = 1/T 4/7 , Nadam+ is almost the same as the stochastic method NIGT ( Cutkosky & Mehta , 2020 ) with only some minor differences . However , we observed that normalizing by ‖zt‖ leads to slow convergence in practice , so we are instead interested in p < 1 . Below , we will show that NAdam+ with p < 1 can achieve a fast rate of 1/ 3.5 , which is the same as NIGT . Theorem 3 . Under the same assumption as in Theorem 1 , further assume σ20 = σ2/T0 and σ2m = σ2/m . By using the step size ηt = αβ 4/3 max ( ‖zt‖2/3 , 0 ) in Algorithm 1 with CL2α4 ≤ 1/14 , 0 = 2β4/3 , in order to have E [ ‖∇F ( wτ ) ‖ ] ≤ for a randomly selected solution wτ from { w1 , . . . , wT } , it suffice to set β = O ( 1/2 ) , T = O ( −2 ) , the initial batch size T0 = 1/β = O ( −1/2 ) , the intermediate batch size as m = 1/β3 = O ( −3/2 ) , which ends up with the total complexity O ( −3.5 ) . Remark : Note that the above theorem establishes the fast convergence rate for Nadam+ with p = 2/3 . Indeed , we can also establish a fast rate of Adam+ ( where p = 1/2 ) in the order ofO ( 1/ 3.625 ) with details provided in the Appendix E .
This paper proposes a new optimizer called Adam+, with two main distinctions from standard Adam template: 1) the first order moment estimate is computed using the gradient evaluated at an extrapolated iterate. 2) the step size is scaled with the square root of the norm of the first order moment, rather than the exponential moving average (EMA) in the previous work. Under Lipschitz continuous gradient, Hessian and bounded gradient assumptions, the complexity for finding a point with small gradient norm is $\epsilon^{-3.5}$, which is a SOTA complexity. The practical performance of the algorithm is evaluated in a range of different tasks and the performance is shown to be consistently promising and comparable to SGD/Momentum SGD.
SP:522aebc6b5d57da5550911d44f91572975118008
Adam$^+$: A Stochastic Method with Adaptive Variance Reduction
1 INTRODUCTION . Adaptive gradient methods ( Duchi et al. , 2011 ; McMahan & Streeter , 2010 ; Tieleman & Hinton , 2012 ; Kingma & Ba , 2014 ; Reddi et al. , 2019 ) are one of the most important variants of Stochastic Gradient Descent ( SGD ) in modern machine learning applications . Contrary to SGD , adaptive gradient methods typically require little parameter tuning still retaining the computational efficiency of SGD . One of the most used adaptive methods is Adam ( Kingma & Ba , 2014 ) , which is considered by practitioners as the de-facto default optimizer for deep learning frameworks . Adam computes the update for every dimension of the model parameter through a moment estimation , i.e. , the estimates of the first and second moments of the gradients . The estimates for first and second moments are updated using exponential moving averages with two different control parameters . These moving averages are the key difference between Adam and previous adaptive gradient methods , such as Adagrad ( Duchi et al. , 2011 ) . Although Adam exhibits great empirical performance , there still remain many mysteries about its convergence . First , it has been shown that Adam may not converge for some objective functions ( Reddi et al. , 2019 ; Chen et al. , 2018b ) . Second , it is unclear what is the benefit that the moving average brings from theoretical point of view , especially its effect on the convergence rate . Third , it has been empirically observed that adaptive gradient methods can have worse generalization performance than its non-adaptive counterpart ( e.g. , SGD ) on various deep learning tasks due to the coordinate-wise learning rates ( Wilson et al. , 2017 ) . The above issues motivate us to design a new algorithm which achieves the best of both worlds , i.e. , provable convergence with benefits from the moving average and enjoying good generalization performance in deep learning . Specifically , we focus on the following optimization problem : min w∈Rd F ( w ) , where we only have access to stochastic gradients of F . Note that F could possibly be nonconvex in w. Due to the non-convexity , our goal is to design a stochastic first-order algorithm to find the -stationary point , i.e. , finding w such that E [ ‖∇F ( w ) ‖ ] ≤ , with low iteration complexity . Our key contribution is the design and analysis of a new stochastic method named Adam+ . Adam+ retains some of the key components of Adam but it also has several noticeable differences : ( i ) it does not maintain the moving average of second moment estimate but instead computes the moving average of first moment estimate at extrapolated points ; ( ii ) its adaptive step size is formed not by dividing the square root of coordinate-wise second moment estimate but instead by dividing the root of the norm of first moment estimate . These features allow us to establish the adaptive convergence of Adam+ . Different from existing adaptive methods where the adaptive convergence depends on the growth rate of stochastic gradients ( Duchi et al. , 2011 ; McMahan & Streeter , 2010 ; Kingma & Ba , 2014 ; Luo et al. , 2019 ; Reddi et al. , 2019 ; Chen et al. , 2018a ; b ; Ward et al. , 2019 ; Li & Orabona , 2019 ; Chen et al. , 2019 ) , our adaptive convergence is due to the adaptive variance reduction property of our first order moment estimate . In existing literature , the variance reduction is usually achieved by large mini-batch ( Goyal et al. , 2017 ) or recursive variance reduction ( Fang et al. , 2018 ; Zhou et al. , 2018 ; Pham et al. , 2020 ; Cutkosky & Orabona , 2019 ) . In contrast , we do not necessarily require large minibatch or computing stochastic gradients at two points per-iteration to achieve the variance reduction . In addition , we also establish a fast rate that matches the state-of-theart complexity under the same conditions of a variant of Adam+ . Table 1 provides an overview of our results and a summary of existing results . We refer readers to Section F for a comprehensive survey of other related work . We further corroborate our theoretical results with an extensive empirical study on various deep learning tasks . Our contributions are summarized below . • We propose a new algorithm with adaptive step size , namely Adam+ , for general nonconvex optimization . We show that it enjoys a new type of data-dependent adaptive convergence that depends on the variance reduction property of first moment estimate . Notably , this data-dependent complexity does not require the presence of sparsity in stochastic gradients to guarantee fast convergence as in previous works ( Duchi et al. , 2011 ; Kingma & Ba , 2014 ; Reddi et al. , 2019 ; Chen et al. , 2019 ; 2018a ) . To the best of our knowledge , this is the first work establishing such new type of data-dependent complexity . • We show that a general variant of our algorithm can achieve O ( −3.5 ) worst-case complexity , which matches the state-of-the-art complexity guarantee under the Hessian Lipschitz assumption ( Cutkosky & Mehta , 2020 ) . • We demonstrate the effectiveness of our algorithms on image classification , language modeling , and automatic speech recognition . Our empirical results show that our proposed algorithm consistently outperforms Adam on all tasks , and it achieves comparable performance with the best-tuned SGD and momentum SGD . Algorithm 1 Adam+ : Good default settings for the tested machine learning problems are α = 0.1 , a = 1 , β = 0.1 , 0 = 10−8 . 1 : Require : α , a ≥ 1 : stepsize parameters 2 : Require : β ∈ ( 0 , 1 ) : Exponential decay rates for the moment estimate 3 : Require : gt ( w ) : unbiased stochastic gradient with parameters w at iteration t 4 : Require : w0 : Initial parameter vector 5 : z0 = g0 ( w0 ) 6 : for t = 0 , . . . , T do 7 : Set ηt = αβ a max ( ‖zt‖1/2 , 0 ) 8 : wt+1 = wt − ηtzt 9 : ŵt+1 = ( 1− 1/β ) wt + 1/β ·wt+1 10 : zt+1 = ( 1− β ) zt + βgt+1 ( ŵt+1 ) 11 : end for 2 ALGORITHM AND THEORETICAL ANALYSIS . In this section , we introduce our algorithm Adam+ ( presented in Algorithm 1 ) and establish its convergence guarantees . Adam+ resembles Adam in several aspects but also has noticeable differences . Similar to Adam , Adam+ also maintains an exponential moving average of first moment ( i.e. , stochastic gradient ) , which is denoted by zt , and uses it for updating the solution in line 8 . However , the difference is that the stochastic gradient is evaluated on an extrapolated data point ŵt+1 , which is an extrapolation of two previous updates wt and wt+1 . Similar to Adam , Adam+ also uses an adaptive step size that is proportional to 1/‖zt‖1/2 . Nonetheless , the difference lies at its adaptive step size is directly computed from the square root of the norm of first moment estimate zt . In contrast , Adam uses an adaptive step size that is proportional to 1/ √ vt , where vt is an exponential moving average of second moment estimate . These two key components of Adam+ , i.e. , extrapolation and adaptive step size from the root norm of the first moment estimate , make it enjoy two noticeable benefits : variance reduction of first moment estimate and adaptive convergence . We shall explain these two benefits later . Before moving to the theoretical analysis , we would like to make some remarks . First , it is worth mentioning that the moving average estimate with extrapolation is inspired by the literature of stochastic compositional optimization ( Wang et al. , 2017 ) . Wang et al . ( 2017 ) showed that the extrapolation helps balancing the noise in the gradients , reducing the bias in the estimates and giving a faster convergence rate . Here , our focus and analysis techniques are quite different . In fact , Wang et al . ( 2017 ) focuses on the compositional optimization while we consider a general nonconvex optimization setting . Moreover , the analysis in ( Wang et al. , 2017 ) mainly deals with the error of the gradient estimator caused by the compositional nature of the problem , while our analysis focuses on carefully designing adaptive normalization to obtain an adaptive and fast convergence rates . A similar extrapolation scheme has been also employed in the algorithm NIGT by Cutkosky & Mehta ( 2020 ) . In later sections , we will also provide a more general variant of Adam+ which subsumes NIGT as a special case . Another important remark is that the update of Adam+ is very different from the famous Nesterov ’ s momentum method . In Nesterov ’ s momentum method , the update of wt+1 uses the stochastic gradient at an extrapolated point ŵt+1 = wt+1 +γ ( wt+1−wt ) with a momentum parameter γ ∈ ( 0 , 1 ) . In contrast , in Adam+ the update of wt+1 is using the moving average estimate at an extrapolated point ŵt+1 = wt+1 + ( 1/β − 1 ) ( wt+1 −wt ) . Finally , Adam+ does not employ coordinate-wise learning rates as in Adam , and hence it is expected to have better generalization performance according to Wilson et al . ( 2017 ) . 2.1 ADAPTIVE VARIANCE REDUCTION AND ADAPTIVE CONVERGENCE . In this subsection , we analyze Adam+ by showing its variance reduction property and adaptive convergence . To this end , we make the following assumptions . Assumption 1 . There exists positive constants L , ∆ , LH , σ and an initial solution w0 such that ( i ) F is L-smooth , i.e. , ‖∇F ( x ) −∇F ( y ) ‖ ≤ L ‖x− y‖ , ∀x , y ∈ Rd . ( ii ) For ∀x ∈ Rd , we have access to a first-order stochastic oracle at time t gt ( x ) such that E [ gt ( x ) ] = ∇F ( x ) , E ‖gt ( x ) −∇F ( x ) ‖2 ≤ σ2 . ( iii ) ∇F is a LH -smooth mapping , i.e. , ‖∇2F ( x ) −∇2F ( y ) ‖ ≤ LH‖x− y‖ , ∀x , y ∈ Rd . ( iv ) F ( w0 ) − F∗ ≤ ∆ < ∞ , where F∗ = infw∈Rd F ( w ) . Remark : Assumption 1 ( i ) and ( ii ) , ( iv ) are standard assumptions made in literature of stochastic non-convex optimization ( Ghadimi & Lan , 2013 ) . Assumption ( iii ) is the assumption that deviates from typical analysis of stochastic methods . We leverage this assumption to explore the benefit of moving average , extrapolation and adaptive normalization . It is also used in some previous works for establishing fast rate of stochastic first-order methods for nonconvex optimization ( Fang et al. , 2019 ; Cutkosky & Mehta , 2020 ) and this assumption is essential to get fast rate due to the hardness result in ( Arjevani et al. , 2019 ) . It is also the key assumption for finding a local minimum in previous works ( Carmon et al. , 2018 ; Agarwal et al. , 2017 ; Jin et al. , 2017 ) . We might also assume that the stochastic gradient estimator in Algorithm 1 satisfies the following variance property . Assumption 2 . Assume that E [ ‖g0 ( w0 ) − ∇F ( w0 ) ‖2 ] ≤ σ20 and E [ ‖gt ( wt ) − ∇F ( wt ) ‖2 ] ≤ σ2m , t ≥ 1 . Remark : When g0 ( resp . gt ) is implemented by a mini-batch stochastic gradient with mini-batch size S , then σ20 ( resp . σ 2 m ) can be set as σ 2/S by Assumption 1 ( ii ) . We differentiate the initial variance and intermediate variance because they contribute differently to the convergence . We first introduce a lemma to characterize the variance of the moving average gradient estimator zt . Lemma 1 . Suppose Assumption 1 and Assumption 2 hold and a ≥ 1 . Then , there exists a sequence of random variables δt satisfying ‖zt −∇F ( wt ) ‖ ≤ δt for ∀t ≥ 0 , E [ δ2t+1 ] ≤ ( 1− β 2 ) E [ δ2t ] + 2β2σ2m + E [ CL2H‖wt+1 −wt‖4 β3 ] ≤ ( 1− β 2 ) E [ δ2t ] + 2β2σ2m + E [ CL2Hα 4β4a−3‖zt‖2 ] , where C = 1944 . Remark : Note that δt is an upper bound of ‖zt − ∇F ( wt ) ‖ , the above lemma can be used to illustrate the variance reduction effect for the gradient estimator zt . To this end , we can bound ‖zt‖2 ≤ 2δ2t + 2‖∇F ( wt ) ‖2 , then the term CL2α4β4a−3δ2t can be canceled with −β/4δ2t with small enough α . Hence , we have Eδ2t+1 ≤ ( 1 − β/4 ) E [ δ2t ] + 2β2σ2m + cE [ ‖∇F ( wt ) ‖2 ] with a small constant c. As the algorithm converges with E [ ‖∇F ( wt ) ‖2 ] and β decreases to zero , the variance of zt will also decrease . Indeed , the above recursion of zt ’ s variance resembles that of the recursive variance reduced gradient estimators ( e.g. , SPIDER ( Fang et al. , 2018 ) , STORM ( Cutkosky & Orabona , 2019 ) ) . The benefit of using Adam+ is that we do not need to compute stochastic gradient twice at each iteration . We can now state our convergence rates for Algorithm 1 . Theorem 1 . Suppose Assumption 1 and Assumption 2 hold . Suppose ‖∇F ( w ) ‖ ≤ G for any w ∈ Rd . By choosing the parameters such that α4 ≤ 1 36CL2H , α ≤ 14L , a = 1 and 0 = β a , we have 1 T T∑ t=1 E ‖∇F ( wt ) ‖2 ≤ GE [ ∑T t=1 ‖zt‖ ] T + ∆ αT + 18σ20 βT + 30βσ2m . ( 1 ) In addition , suppose the initial batch size is T0 and the intermediate batch size is m , and choose β = T−b with 0 ≤ b ≤ 1 , we have 1 T T∑ t=1 E ‖∇F ( wt ) ‖2 ≤ E [ G ∑T t=1 ‖zt‖ ] T + ∆ αT + 18σ2 T 1−bT0 + 30σ2 mT b . ( 2 ) Theorem 2 . Suppose Assumption 1 and Assumption 2 hold . By choosing parameters such that 640α3L 3/2 H ≤ 1/120 , a = 1 , 0 = 0 , β = 1/T s with s = 2/3 then it takes T = O ( −4.5 ) number of iterations to ensure that 1 T T∑ t=1 E [ ‖∇F ( wt ) ‖3/2 ] ≤ 3/2 , 1 T E [ T∑ t=1 δ 3/2 t ] ≤ 3/2 . Remarks : • From Theorem 1 , we can observe that the convergence rate of Adam+ crucially depends on the growth rate of E [ ∑T t=1 ‖zt‖ ] , which gives a data-dependent adaptive complexity . If E [ ∑T t=1 ‖zt‖ ] ≤ Tα with α < 1 , then the algorithm converges . Smaller α implies faster convergence . Our goal is to ensure that 1T ∑T t=1 E‖∇F ( wt ) ‖2 ≤ 2 . Choosing b = 1−α , m = O ( 1 ) and T0 = T 1−α = O ( −2 ) , and we end up with T = O ( − 2 1−α ) complexity . • Theorem 2 shows that in the ergodic sense , the Algorithm Adam+ always converges , and the variance gets smaller when the number of iteration gets larger . Theorem 2 rules out the case that the magnitude of zt converges to a constant and the bound ( 2 ) in Theorem 1 becomes vacuous . • To compare with Adam-style algorithms ( e.g. , Adam , AdaGrad ) , these algorithms ’ convergence depend on the growth rate of stochastic gradient , i.e. , ∑d i=1 ‖g1 : T , i‖/T , where g1 : T , i = [ g1 , i , . . . , gT , i ] denotes the i-th coordinate of all historical stochastic gradients . Hence , the data determines the growth rate of stochastic gradient . If the stochastic gradients are not sparse , then its growth rate may not be slow and these Adam-style algorithms may suffer from slow convergence . In contrast , for Adam+ the convergence can be accelerated by the variance reduction property . Note that we have E [ ∑T t=1 ‖zt‖ ] /T ≤ E [ ∑T t=1 ( δt + ‖∇F ( wt ) ‖ ) ] /T . Hence , Adam+ ’ s convergence depends on the variance reduction property of zt . 2.2 A GENERAL VARIANT OF ADAM+ : FAST CONVERGENCE WITH LARGE MINI-BATCH Next , we introduce a more general variant of Adam+ by making a simple change . In particular , we keep all steps the same as in Algorithm 1 except the adaptive step size is now set as ηt = αβa max ( ‖zt‖p , 0 ) , where p ∈ [ 1/2 , 1 ) is parameter . We refer to this general variant of Adam + as power normalized Adam+ ( Nadam+ ) . This generalization allows us to compare with some existing methods and to establish fast convergence rate . First , we notice that when setting p = 1 and a = 5/4 and β = 1/T 4/7 , Nadam+ is almost the same as the stochastic method NIGT ( Cutkosky & Mehta , 2020 ) with only some minor differences . However , we observed that normalizing by ‖zt‖ leads to slow convergence in practice , so we are instead interested in p < 1 . Below , we will show that NAdam+ with p < 1 can achieve a fast rate of 1/ 3.5 , which is the same as NIGT . Theorem 3 . Under the same assumption as in Theorem 1 , further assume σ20 = σ2/T0 and σ2m = σ2/m . By using the step size ηt = αβ 4/3 max ( ‖zt‖2/3 , 0 ) in Algorithm 1 with CL2α4 ≤ 1/14 , 0 = 2β4/3 , in order to have E [ ‖∇F ( wτ ) ‖ ] ≤ for a randomly selected solution wτ from { w1 , . . . , wT } , it suffice to set β = O ( 1/2 ) , T = O ( −2 ) , the initial batch size T0 = 1/β = O ( −1/2 ) , the intermediate batch size as m = 1/β3 = O ( −3/2 ) , which ends up with the total complexity O ( −3.5 ) . Remark : Note that the above theorem establishes the fast convergence rate for Nadam+ with p = 2/3 . Indeed , we can also establish a fast rate of Adam+ ( where p = 1/2 ) in the order ofO ( 1/ 3.625 ) with details provided in the Appendix E .
This paper proposes the Adam+ algorithm that maintains an exponential moving average of the first moment and normalizes it by its $p$-th moment for some $p \in (1/2, 1)$. When $p = 2/3$, with appropriate hyperparameters, Adam+ achieves the state-of-the-art complexity $O(1/\epsilon^{3.5})$ to obtain an approximate first-order stationary point for smooth objectives with smooth Hessians. The proof technique is similar to that for SCGD by Wang et al. (2017), which construct a Lyapunov function for algorithms of this kind.
SP:522aebc6b5d57da5550911d44f91572975118008
Deep Goal-Oriented Clustering
1 INTRODUCTION . Much of the advances in supervised learning in the past decade are due to the development of deep neural networks ( DNN ) , a class of hierarchical function approximators that are capable of learning complex input-output relationships . Prime examples of such advances include image recognition ( Krizhevsky et al. , 2012 ) , speech recognition ( Nassif et al. , 2019 ) , and neural translation ( Bahdanau et al. , 2015 ) . However , with the explosion of the size of modern datasets , it becomes increasingly unrealistic to manually annotate all available data for training . Hence , understanding inherent data structure through unsupervised clustering is of increasing importance . Several approaches to apply DNNs to unsupervised clustering have been proposed in the past few years ( Caron et al. , 2018 ; Law et al. , 2017 ; Xie et al. , 2016 ; Shaham et al. , 2018 ) , centering around the concept that the input space in which traditional clustering algorithms operate is of importance . Hence , learning this space from data is desirable , in particular , for complex data . Despite the improvements these approaches have made on benchmark clustering datasets , the ill-defined , ambiguous nature of clustering still remains a challenge . Such ambiguity is particularly problematic in scientific discovery , sometimes requiring researchers to choose from different , but potentially equally meaningful clustering results when little information is available a priori ( Ronan et al. , 2016 ) . When facing such ambiguity , using direct side-information to reduce clustering ambivalence proves to be a fruitful direction ( Xing et al. , 2002 ; Khashabi et al. , 2015 ; Jin et al. , 2013 ) . Direct sideinformation is usually available in terms of constraints , such as the must-link and the can not -link constraints ( Wang & Davidson , 2010 ; Wagstaff & Cardie , 2000 ) , or via a pre-conceived notion of similarity ( Xing et al. , 2002 ) . However , defining such direct side-information requires human expertise , which could be labor intensive and potentially vulnerable to labeling errors . On the contrary , indirect , but informative , side-information might exist in abundance , and may not require human expertise to obtain . Being able to learn from such indirect information to form a congruous clustering strategy is thus immensely valuable . Main Contributions We propose Deep Goal-Oriented Clustering ( DGC ) , a probabilistic model that is capable of using indirect , but informative , side-information to form a pertinent clustering strategy . Specifically : 1 ) We combine supervision via side-information and unsupervised data structure modeling in a probabilistic manner ; 2 ) We make minimal assumptions on what form the supervised side-information might take , and assume no explicit correspondence between the sideinformation and the clusters ; 3 ) We train DGC end-to-end so that the model simultaneously learns from the available side-information while forming a desired clustering strategy . 2 RELATED WORK . Most related work in the literature can be classified into two categories : 1 ) Methods that utilize extra side-information to form better , less ambiguous clusters ; however , such side-information needs to be provided beforehand and can not be learned ; 2 ) Methods that can learn from the provided labels to lessen the ambiguity in the formed clusters , but these methods rely on the cluster assumption ( detailed below ) , and usually assume that the provided labels are discrete and the ground truth labels . This excludes the possibility of learning from indirectly related , but informative side-information . We propose a unified framework that allows using informative side-information directly or indirectly to arrive at better formed clusters . Latent space sharing among different tasks has been studied in a VAE setting ( Le et al. , 2018 ; Xie & Ma , 2019 ) . In this work we utilize this latent space sharing framework , but instead focus on clustering with the aid of general , indirect side-information . Side-information as constraints Using side-information to form better clusters is well-studied . Wagstaff & Cardie ( 2000 ) consider both must-link and can not -link constraints in the context of K-means clustering . Motivated by image segmentation , Orbanz & Buhmann ( 2007 ) proposed a probabilistic model that can incorporate must-link constraints . Khashabi et al . ( 2015 ) proposed a nonparametric Bayesian hierarchical model to incorporate noisy side-information as soft-constraints . Vu et al . ( 2019 ) utilize constraints and cluster labels as side information . Mazumdar & Saha ( 2017 ) give complexity bounds when provided with an oracle that can be queried for side information . Wasid & Ali ( 2019 ) incorporate side information through the use of fuzzy sets . In supervised clustering , the side-information is the a priori known complete clustering for the training set , which is being used as a constraint to learn a mapping between the data and the given clustering ( Finley & Joachims , 2005 ) . In contrast , we do not assume that the constraints are given a priori . Instead , we let the side-information guide the clustering procedure during the training process . Semi-supervised methods & the cluster assumption Semi-supervised clustering approaches generally assume that they only have access to a fraction of the true cluster labels . Via constraints as the ones discussed , the available labels are propagated to unlabeled data , which can help mitigate the ambiguity in choosing among different clustering strategies ( Bair , 2013 ) . The generative approach to semi-supervised learning introduced in Kingma et al . ( 2014 ) is based on a hierarchical generative model with two variational layers . Although it was originally meant for semi-supervised classification tasks , it can also be used for clustering . However , if used for clustering , it has to strictly rely on the cluster assumption , which states that there exists a direct correspondence between labels/classes and clusters ( Färber et al. , 2010 ; Chapelle et al. , 2006 ) . We show that this approach is a special case of our framework without the probabilistic ensemble component ( see Sec . 4.2 ) and when certain distributional assumptions are made . Sansone et al . ( 2016 ) proposed a method for joint classification and clustering to address the stringent cluster assumption most approaches make by modeling the cluster indices and the class labels separately , underscoring the possibility that each cluster may consist of multiple class labels . Deploying a mixture of factor analysers as the underlying probabilistic framework , they also used a variational approximation to maximize the joint log-likelihood . In this work , we generalize the notion of learning from discrete , ground truth labels to learning from indirect , but informative side-information . We make virtually no assumptions on the form of y nor its relations to the clusters . This makes our approach more applicable to general settings . 3 BACKGROUND & PROBLEM SETUP . 3.1 BACKGROUND—VARIATIONAL DEEP EMBEDDING . The starting point for DGC is the variational auto-encoder ( VAE ) ( Kingma & Welling , 2014 ) with the prior distribution of the latent code chosen as a Gaussian mixture distribution . This is introduced in Jiang et al . ( 2017 ) as VaDE . We briefly review the generative VaDE approach here to provide the background for DGC . We adopt the notation that lower case letters denote samples from their corresponding distributions ; bold , lower case letters denote random variables/vectors ; and bold upper case letters denote random matrices . Assume the prior distribution of the latent code , z , belongs to the family of Gaussian mixture distributions , i.e . p ( z ) = ∑ c p ( z|c ) p ( c ) = ∑ c πcN ( µc , σ2c I ) where c is a random variable , with prior probability πc , indexing the normal component with mean µc and variance σ2c . VaDE allows for the clustering of the input data in the latent space , with each component of the Gaussian mixture prior representing an underlying cluster . A VAE-based model can be efficiently described in terms of its generative process and inference procedure . Given an input x ∈ Rd , the following decomposition of the joint probability p ( x , z , c ) details VaDE ’ s generative process : p ( x , z , c ) = p ( x|z ) p ( z|c ) p ( c ) . In words , we first sample the component index c from a prior categorical distribution p ( c ) , then sample the latent code z from the component p ( z|c ) , and lastly reconstruct the input x through the reconstruction network p ( x|z ) . To perform inference and learn from the data , VaDE is constructed to maximize the log-likelihood of the input data x by maximizing its evidence lower bound ( ELBO ) : log p ( x ) ≥ Eq ( z|x ) log p ( x|z ) − Eq ( c|x ) log q ( c|x ) p ( c ) − Eq ( z , c|x ) log q ( z|x ) p ( z|c ) ( 1 ) where , given the input x , q ( z , c|x ) denotes the variational posterior distribution over the latent variables , and Ed denotes the expectation wrt . distribution d. With proper assumptions on the prior and variational posterior distributions , the ELBO in Eq . 1 admits a closed-form expression in terms of the parameters of those distributions . We refer readers to Jiang et al . ( 2017 ) for additional details . 3.2 PROBLEM SETUP Unlike the unsupervised settings , we do assume we have a response variable y , and our goal is to leverage y to inform a better clustering strategy . Abstractly , given the input-output random variable pair ( x , y ) , we seek to divide the probability space of x into non-overlapping subspaces that are meaningful in explaining the output y . In other words , we want to use the prediction task of mapping data points , x , sampled from the probability space of x to their corresponding sampled outcomes y as a teaching agent , to guide the process of dividing the probability space of x into subspaces that optimally explain y . Since our goal is to discover the subspace-structure without knowing a priori whether such a structure indeed exists , a probabilistic framework is more appropriate due to its ability to incorporate and reason with uncertainty . To this end , we use and extend the VaDE framework , with the following assumption imposed on the latent code that specifically caters to our setting . Assume the input x carries predictive information with respect to the output y . Since the latent code z should inherit sufficient information from which the input x can be reconstructed , it is reasonable to assume that z also inherits that predictive information . This assumption implies that x and y are conditionally independent given z , i.e . p ( x , y|z ) = p ( x|z ) p ( y|z ) . 4 DEEP GOAL-ORIENTED CLUSTERING . 4.1 GENERATIVE PROCESS . In order to incorporate y into a probabilistic model , recall from our previous discussion that y might manifest with respect to the input differently across different subspaces of the input space . Viewing p ( y|z ) as a conditional probability distribution over y resulting from a functional transformation from z to the space of probability distributions over y , we can assume that the ground truth transformation function , gc , is different for each subspace indexed by c. If z ∼ p ( z|c ) for some index c , we assume p ( y|z , c ) ∝ gc ( z ) for some subspace-specific gc . As a result , we learn a different mapping function for each subspace . The overall generative process of our model is as follows : 1 . Generate c ∼ Cat ( π ) ; 2 . Generate z ∼ p ( z|c ) ; 3 . Generate x ∼ p ( x|z ) ; 4 . Generate y ∼ p ( y|z , c ) . The Bayesian network that underlies DGC is shown in Fig . 1 , and the joint distribution of x , y , z , and c can be decomposed as : p ( x , y , z , c ) = p ( y|z , c ) p ( x|z ) p ( z|c ) p ( c ) .
This paper introduces Deep Goal Oriented Clustering, an approach for joint clustering and classification. The approach shares a latent embedding for the data between the two tasks. The latent embedding is parameterized by a mixture of Gaussians. The approach gives a probabilistic, VAE-based formulation and derives the variational lower bound for the model. The authors run experiments investigating the effectiveness of their approach and the impact of the clustering-component of their approach.
SP:57ac36954da5fb78b9f816c3aac6fd19d9c70e4f
Deep Goal-Oriented Clustering
1 INTRODUCTION . Much of the advances in supervised learning in the past decade are due to the development of deep neural networks ( DNN ) , a class of hierarchical function approximators that are capable of learning complex input-output relationships . Prime examples of such advances include image recognition ( Krizhevsky et al. , 2012 ) , speech recognition ( Nassif et al. , 2019 ) , and neural translation ( Bahdanau et al. , 2015 ) . However , with the explosion of the size of modern datasets , it becomes increasingly unrealistic to manually annotate all available data for training . Hence , understanding inherent data structure through unsupervised clustering is of increasing importance . Several approaches to apply DNNs to unsupervised clustering have been proposed in the past few years ( Caron et al. , 2018 ; Law et al. , 2017 ; Xie et al. , 2016 ; Shaham et al. , 2018 ) , centering around the concept that the input space in which traditional clustering algorithms operate is of importance . Hence , learning this space from data is desirable , in particular , for complex data . Despite the improvements these approaches have made on benchmark clustering datasets , the ill-defined , ambiguous nature of clustering still remains a challenge . Such ambiguity is particularly problematic in scientific discovery , sometimes requiring researchers to choose from different , but potentially equally meaningful clustering results when little information is available a priori ( Ronan et al. , 2016 ) . When facing such ambiguity , using direct side-information to reduce clustering ambivalence proves to be a fruitful direction ( Xing et al. , 2002 ; Khashabi et al. , 2015 ; Jin et al. , 2013 ) . Direct sideinformation is usually available in terms of constraints , such as the must-link and the can not -link constraints ( Wang & Davidson , 2010 ; Wagstaff & Cardie , 2000 ) , or via a pre-conceived notion of similarity ( Xing et al. , 2002 ) . However , defining such direct side-information requires human expertise , which could be labor intensive and potentially vulnerable to labeling errors . On the contrary , indirect , but informative , side-information might exist in abundance , and may not require human expertise to obtain . Being able to learn from such indirect information to form a congruous clustering strategy is thus immensely valuable . Main Contributions We propose Deep Goal-Oriented Clustering ( DGC ) , a probabilistic model that is capable of using indirect , but informative , side-information to form a pertinent clustering strategy . Specifically : 1 ) We combine supervision via side-information and unsupervised data structure modeling in a probabilistic manner ; 2 ) We make minimal assumptions on what form the supervised side-information might take , and assume no explicit correspondence between the sideinformation and the clusters ; 3 ) We train DGC end-to-end so that the model simultaneously learns from the available side-information while forming a desired clustering strategy . 2 RELATED WORK . Most related work in the literature can be classified into two categories : 1 ) Methods that utilize extra side-information to form better , less ambiguous clusters ; however , such side-information needs to be provided beforehand and can not be learned ; 2 ) Methods that can learn from the provided labels to lessen the ambiguity in the formed clusters , but these methods rely on the cluster assumption ( detailed below ) , and usually assume that the provided labels are discrete and the ground truth labels . This excludes the possibility of learning from indirectly related , but informative side-information . We propose a unified framework that allows using informative side-information directly or indirectly to arrive at better formed clusters . Latent space sharing among different tasks has been studied in a VAE setting ( Le et al. , 2018 ; Xie & Ma , 2019 ) . In this work we utilize this latent space sharing framework , but instead focus on clustering with the aid of general , indirect side-information . Side-information as constraints Using side-information to form better clusters is well-studied . Wagstaff & Cardie ( 2000 ) consider both must-link and can not -link constraints in the context of K-means clustering . Motivated by image segmentation , Orbanz & Buhmann ( 2007 ) proposed a probabilistic model that can incorporate must-link constraints . Khashabi et al . ( 2015 ) proposed a nonparametric Bayesian hierarchical model to incorporate noisy side-information as soft-constraints . Vu et al . ( 2019 ) utilize constraints and cluster labels as side information . Mazumdar & Saha ( 2017 ) give complexity bounds when provided with an oracle that can be queried for side information . Wasid & Ali ( 2019 ) incorporate side information through the use of fuzzy sets . In supervised clustering , the side-information is the a priori known complete clustering for the training set , which is being used as a constraint to learn a mapping between the data and the given clustering ( Finley & Joachims , 2005 ) . In contrast , we do not assume that the constraints are given a priori . Instead , we let the side-information guide the clustering procedure during the training process . Semi-supervised methods & the cluster assumption Semi-supervised clustering approaches generally assume that they only have access to a fraction of the true cluster labels . Via constraints as the ones discussed , the available labels are propagated to unlabeled data , which can help mitigate the ambiguity in choosing among different clustering strategies ( Bair , 2013 ) . The generative approach to semi-supervised learning introduced in Kingma et al . ( 2014 ) is based on a hierarchical generative model with two variational layers . Although it was originally meant for semi-supervised classification tasks , it can also be used for clustering . However , if used for clustering , it has to strictly rely on the cluster assumption , which states that there exists a direct correspondence between labels/classes and clusters ( Färber et al. , 2010 ; Chapelle et al. , 2006 ) . We show that this approach is a special case of our framework without the probabilistic ensemble component ( see Sec . 4.2 ) and when certain distributional assumptions are made . Sansone et al . ( 2016 ) proposed a method for joint classification and clustering to address the stringent cluster assumption most approaches make by modeling the cluster indices and the class labels separately , underscoring the possibility that each cluster may consist of multiple class labels . Deploying a mixture of factor analysers as the underlying probabilistic framework , they also used a variational approximation to maximize the joint log-likelihood . In this work , we generalize the notion of learning from discrete , ground truth labels to learning from indirect , but informative side-information . We make virtually no assumptions on the form of y nor its relations to the clusters . This makes our approach more applicable to general settings . 3 BACKGROUND & PROBLEM SETUP . 3.1 BACKGROUND—VARIATIONAL DEEP EMBEDDING . The starting point for DGC is the variational auto-encoder ( VAE ) ( Kingma & Welling , 2014 ) with the prior distribution of the latent code chosen as a Gaussian mixture distribution . This is introduced in Jiang et al . ( 2017 ) as VaDE . We briefly review the generative VaDE approach here to provide the background for DGC . We adopt the notation that lower case letters denote samples from their corresponding distributions ; bold , lower case letters denote random variables/vectors ; and bold upper case letters denote random matrices . Assume the prior distribution of the latent code , z , belongs to the family of Gaussian mixture distributions , i.e . p ( z ) = ∑ c p ( z|c ) p ( c ) = ∑ c πcN ( µc , σ2c I ) where c is a random variable , with prior probability πc , indexing the normal component with mean µc and variance σ2c . VaDE allows for the clustering of the input data in the latent space , with each component of the Gaussian mixture prior representing an underlying cluster . A VAE-based model can be efficiently described in terms of its generative process and inference procedure . Given an input x ∈ Rd , the following decomposition of the joint probability p ( x , z , c ) details VaDE ’ s generative process : p ( x , z , c ) = p ( x|z ) p ( z|c ) p ( c ) . In words , we first sample the component index c from a prior categorical distribution p ( c ) , then sample the latent code z from the component p ( z|c ) , and lastly reconstruct the input x through the reconstruction network p ( x|z ) . To perform inference and learn from the data , VaDE is constructed to maximize the log-likelihood of the input data x by maximizing its evidence lower bound ( ELBO ) : log p ( x ) ≥ Eq ( z|x ) log p ( x|z ) − Eq ( c|x ) log q ( c|x ) p ( c ) − Eq ( z , c|x ) log q ( z|x ) p ( z|c ) ( 1 ) where , given the input x , q ( z , c|x ) denotes the variational posterior distribution over the latent variables , and Ed denotes the expectation wrt . distribution d. With proper assumptions on the prior and variational posterior distributions , the ELBO in Eq . 1 admits a closed-form expression in terms of the parameters of those distributions . We refer readers to Jiang et al . ( 2017 ) for additional details . 3.2 PROBLEM SETUP Unlike the unsupervised settings , we do assume we have a response variable y , and our goal is to leverage y to inform a better clustering strategy . Abstractly , given the input-output random variable pair ( x , y ) , we seek to divide the probability space of x into non-overlapping subspaces that are meaningful in explaining the output y . In other words , we want to use the prediction task of mapping data points , x , sampled from the probability space of x to their corresponding sampled outcomes y as a teaching agent , to guide the process of dividing the probability space of x into subspaces that optimally explain y . Since our goal is to discover the subspace-structure without knowing a priori whether such a structure indeed exists , a probabilistic framework is more appropriate due to its ability to incorporate and reason with uncertainty . To this end , we use and extend the VaDE framework , with the following assumption imposed on the latent code that specifically caters to our setting . Assume the input x carries predictive information with respect to the output y . Since the latent code z should inherit sufficient information from which the input x can be reconstructed , it is reasonable to assume that z also inherits that predictive information . This assumption implies that x and y are conditionally independent given z , i.e . p ( x , y|z ) = p ( x|z ) p ( y|z ) . 4 DEEP GOAL-ORIENTED CLUSTERING . 4.1 GENERATIVE PROCESS . In order to incorporate y into a probabilistic model , recall from our previous discussion that y might manifest with respect to the input differently across different subspaces of the input space . Viewing p ( y|z ) as a conditional probability distribution over y resulting from a functional transformation from z to the space of probability distributions over y , we can assume that the ground truth transformation function , gc , is different for each subspace indexed by c. If z ∼ p ( z|c ) for some index c , we assume p ( y|z , c ) ∝ gc ( z ) for some subspace-specific gc . As a result , we learn a different mapping function for each subspace . The overall generative process of our model is as follows : 1 . Generate c ∼ Cat ( π ) ; 2 . Generate z ∼ p ( z|c ) ; 3 . Generate x ∼ p ( x|z ) ; 4 . Generate y ∼ p ( y|z , c ) . The Bayesian network that underlies DGC is shown in Fig . 1 , and the joint distribution of x , y , z , and c can be decomposed as : p ( x , y , z , c ) = p ( y|z , c ) p ( x|z ) p ( z|c ) p ( c ) .
In traditional clustering algorithms, incorporation of “side-information”, or additional features only available during training time, typically assume some prior knowledge of the ground-truth clusters, or constraints on those clusters. However, this need not be the case, as training samples may contain arbitrary information which only indirectly corresponds to true cluster labels. This work proposes a novel method, called Deep Goal-Oriented Clustering (DGC), to incorporate such arbitrary “side-information” into a probabilistic auto-encoder based clustering algorithm.
SP:57ac36954da5fb78b9f816c3aac6fd19d9c70e4f
Fast and Complete: Enabling Complete Neural Network Verification with Rapid and Massively Parallel Incomplete Verifiers
1 INTRODUCTION . Although neural networks ( NNs ) have achieved great success on various complicated tasks , they remain susceptible to adversarial examples ( Szegedy et al. , 2013 ) : imperceptible perturbations of test samples might unexpectedly change the NN predictions . Therefore , it is crucial to conduct formal verification for NNs such that they can be adopted in safety or security-critical settings . Formally , the neural network verification problem can be cast into the following decision problem : Given a neural network f ( · ) , an input domain C , and a property P . ∀x ∈ C , does f ( x ) satisfy P ? The property P is typically a set of desirable outputs of the NN conditioned on the inputs . Typically , consider a binary classifier f ( x ) and a positive example x0 ( f ( x0 ) ≥ 0 ) , we can set P to be nonnegative numbers R+ and x is bounded within an l∞ norm ball C = { x|‖x − x0‖∞ ≤ } . The success of verification guarantees that the label of x0 can not flip for any perturbed inputs within C. In this paper we study the complete verification setting , where given sufficient time , the verifier should give a definite “ yes/no ” answer for a property under verification . In the above setting , it must solve the non-convex optimization problem minx∈C f ( x ) to a global minimum . Complete NN verification is generally a challenging NP-Hard problem ( Katz et al. , 2017 ) which usually requires expensive formal verification methods such as SMT ( Katz et al. , 2017 ) or MILP solvers ( Tjeng et al. , 2019b ) . On the other hand , incomplete solvers such as convex relaxations of NNs ( Salman et al. , 2019 ) can only provide a sound analysis , i.e. , they can only approximate the lower bound of minx∈C f ( x ) as f and verify the property when f ≥ 0 . No conclusion can be drawn when f < 0 . Recently , a Branch and Bound ( BaB ) style framework ( Bunel et al. , 2018 ; 2020b ) has been adopted for efficient complete verification . BaB solves the optimization problem minx∈C f ( x ) to a global minimum by branching into multiple sub-domains recursively and bounding the solution for each sub-domain using incomplete verifiers . BaB typically uses a Linear Programming ( LP ) bounding procedure as an incomplete verifier to provide feasibility checking and relatively tight bounds for each sub-domain . However , the relatively high solving cost of LPs and incapability of parallelization ( especially on massively parallel hardware accelerators like GPUs or TPUs ) greatly limit the performance and scalability of the existing complete BaB based verifiers . In this paper , we aim to use fast and typically weak incomplete verifiers for complete verification . Specifically , we focus on a class of incomplete verifiers using efficient bound propagation operations , referred to as linear relaxation based perturbation analysis ( LiRPA ) algorithms ( Xu et al. , 2020 ) . Representative algorithms in this class include convex outer adversarial polytope ( Wong & Kolter , 2018 ) , CROWN ( Zhang et al. , 2018 ) and DeepPoly ( Singh et al. , 2019b ) . LiRPA algorithms exhibit high parallelism as the bound propagation process is similar to forward or backward propagation of NNs , which can fully exploit machine learning accelerators ( e.g. , GPUs and TPUs ) . Although LiRPA bounds are very efficient for incomplete verification , especially in training certified adversarial defenses ( Wong et al. , 2018 ; Mirman et al. , 2018 ; Wang et al. , 2018a ; Zhang et al. , 2020 ) , they are generally considered too loose to be useful compared to LPs in the complete verification settings with BaB . As we will demonstrate later , using LiRPA bounds naively in BaB can not even guarantee the completeness when splitting ReLU nodes , and thus we need additional measures to make them useful for complete verification . In fact , LiRPA methods have been used to get upper and lower bounds for each ReLU neuron in constructing tighter LPs ( Bunel et al. , 2018 ; Lu & Kumar , 2020 ) . It was also used in ( Wang et al. , 2018c ) for verifying small-scale problems with relatively low dimensional input domains using input splits , but splitting the input space can be quite ineffective ( Bunel et al. , 2018 ) and is unable to scale to high dimensional input case like CIFAR-10 . Except one concurrent work ( Bunel et al. , 2020a ) , most complete verifiers are based on relatively expensive solvers like LP and can not fully take benefit from massively parallel hardware ( e.g. , GPUs ) to obtain tight bounds for accelerating large-scale complete verification problems . Our main contributions are : • We show that LiRPA bounds , when improved with fast gradient optimizers , can potentially outperform bounds obtained by LP verifiers . This is because LiRPA allows joint optimization of both intermediate layer bounds of ReLU neurons ( which determine the tightness of relaxation ) and output bounds , while LP can only optimize output bounds with fixed relaxations on ReLU neurons . • We show that BaB purely using LiRPA bounds is insufficient for complete verification due to the lack of feasibility checking for ReLU node splits . To address this issue , we design our algorithm to only invoke LP when absolutely necessary and exploits hardware parallelism when possible . • To fully exploit the hardware parallelism on the machine learning accelerators , we use a batch splitting approach that splits on multiple neurons simultaneously , further improving our efficiency . • On a few standard and representative benchmarks , our proposed NN verification framework can outperform previous baselines significantly , with a speedup of around 30X compared to basic BaB+LP baselines , and up to 3X compared to recent state-of-the-art complete verifiers . 2 BACKGROUND . 2.1 FORMAL DEFINITION OF NEURAL NETWORK ( NN ) VERIFICATION . Notations of NN . For illustration , we define an L-layer feedforward NN f : R|x| → R with L weights W ( i ) ( i ∈ { 1 , · · · , L } ) recursively as h ( i ) ( x ) = W ( i ) g ( i−1 ) ( x ) , hidden layer g ( i ) ( x ) = ReLU ( h ( i ) ( x ) ) , input layer g ( 0 ) ( x ) = x , and final output f ( x ) = h ( L ) ( x ) . For simplicity we ignore biases . We sometimes omit x and use h ( i ) j to represent the pre-activation of the j-th ReLU neuron in i-th layer for x ∈ C , and we use g ( i ) j to represent the post-activation value . We focus on verifying ReLU based NNs , but our method is generalizable to other activation functions supported by LiRPA . NN Verification Problem . Given an input x , its bounded input domain C , and a feedforward NN f ( · ) , the aim of formal verification is to prove or disprove certain properties P of NN outputs . Since most properties studied in previous works can be expressed as a Boolean expression over a linear equation of network output , where the linear property can be merged into the last layer weights of a NN , the ultimate goal of complete verification reduces to prove or disprove : ∀x ∈ C , f ( x ) ≥ 0 ( 1 ) One way to prove Eq . 1 is to solve minx∈C f ( x ) . Due to the non-convexity of NNs , finding the exact minimum of f ( x ) over x ∈ C is challenging as the optimization process is generally NPcomplete ( Katz et al. , 2017 ) . However , in practice , a sound approximation of the lower bound for f ( x ) , denoted as f , can be more easily obtained and is sufficient to verify the property . Thus , a good verification strategy to get a tight approximation f can save significant time cost . Note that f must be sound , i.e. , ∀x ∈ C , f ≤ f ( x ) , proving f ≥ 0 is sufficient to prove the property f ( x ) ≥ 0 . 2.2 THE BRANCH AND BOUND ( BAB ) FRAMEWORK FOR NEURAL NETWORK VERIFICATION . Branch and Bound ( BaB ) , an effective strategy in solving traditional combinatorial optimization problems , has been customized and widely adopted for NN verification ( Bunel et al. , 2018 ; 2020b ) . Specifically , BaB based verification framework is a recursive process , consisting of two main steps : branching and bounding . For branching , BaB based methods will divide the bounded input domain C into sub-domains { Ci|C = ⋃ i Ci } , each defined as a new independent verification problem . For instance , it can split a ReLU unit g ( k ) j = ReLU ( h ( k ) j ) to be negative and positive cases as C0 = C ∩ ( h ( k ) j ≥ 0 ) and C1 = C ∩ ( h ( k ) j < 0 ) for a ReLU-based network ; for each sub-domain Ci , BaB based methods perform bounding to obtain a relaxed but sound lower bound fCi . A tightened global lower bound over C can then be obtained by taking the minimum values of the sub-domain lower bounds from all the sub-domains : f = mini fCi . Branching and bounding will be performed recursively to tighten the approximated global lower bound over C until either ( 1 ) the global lower bound f becomes larger than 0 and prove the property or ( 2 ) a violation ( e.g. , adversarial example ) is located in a sub-domain to disprove the property . Essentially , we build a search tree where each leaf is a sub-domain , and the property P can be proven only when it is valid on all leaves . Soundness of BaB We say the verification process is sound if we can always trust the “ yes ” ( P is verified ) answer given by the verifier . It is straightforward to see that the whole BaB based verification process is sound as long as the bounding method used for each sub-domain Ci is sound . Completeness of BaB The completeness of the BaB-based NN verification process , which was usually assumed true in some previous works ( Bunel et al. , 2020b ; 2018 ) , in fact , is not always true even if all possible sub-domains are considered with a sound bounding method . Additional requirements for the bounding method are required - we point out that a key factor for completeness involves feasibility checking in the bounding method which we will discuss in Section 3.2 . Branching in BaB Since branching step determines the shape of the search tree , the main challenge is to efficiently choose a good leaf to split , which can significantly reduce the total number of branches and running time . In this work we focus on branching on activation ( ReLU ) nodes . BaBSR ( Bunel et al. , 2018 ) includes a simple branching heuristic which assigns each ReLU node a score to estimate the improvement for tightening f by splitting it , and splits the node with the highest score . Bounding with Linear Programming ( LP ) A typical bounding method used in BaB based verification is the Linear Programming bounding procedure ( sometimes simply referred to as “ LP ” or “ LP verifier ” in our paper ) . Specifically , we transform the original verification problem into a linear programming problem by relaxing every activation unit as a convex ( linear ) domain ( Ehlers , 2017 ) and then get the lower bound fCi with a linear solver given domain Ci . For instance , as shown in Figure 1a , g ( i ) j = ReLU ( h ( i ) j ) can be linearly relaxed with the following 3 constraints : ( 1 ) g ( i ) j ≥ h ( i ) j ; ( 2 ) g ( i ) j ≥ 0 ; ( 3 ) g ( i ) j ≤ u ( i ) j u ( i ) j −l ( i ) j ( h ( i ) j − l ( i ) j ) . Note that the lower bound l ( i ) j and upper bound u ( i ) j for each activation node h ( i ) j are required in the LP construction given Ci . They are typically computed by the existing cheap bounding methods like LiRPA variants ( Wong & Kolter , 2018 ) with low cost . The tighter the intermediate bounds ( l ( i ) j , u ( i ) j ) are , the tighter f approximated by LP is . 2.3 LINEAR RELAXATION BASED PERTURBATION ANALYSIS ( LiRPA ) Bound propagation in LiRPA We used Linear Relaxation based Perturbation Analysis ( LiRPA ) 1 as bound procedure in BaB to get linear upper and lower bounds of NN output w.r.t input x ∈ C : Ax+ b ≤ f ( x ) ≤ Ax+ b , x ∈ C ( 2 ) 1We only use the backward mode LiRPA bounds ( e.g. , CROWN and DeepPoly ) in this paper . l ( i ) j u ( i ) j x ( i ) j h ( i ) j A lower bound f can then be simply obtained by taking the lower bound of the linear equation Ax+ b w.r.t input x ∈ C , which can be obtained via Hölder ’ s inequality when C is a ` p norm ball . To get the coefficients A , A , b , b , LiRPA propagates bounds of f ( x ) as a linear function to the output of each layer , in a backward manner . At the output layer h ( L ) ( x ) we simply have : Ih ( L ) ( x ) ≤ f ( x ) ≤ Ih ( L ) ( x ) , x ∈ C ( 3 ) Then , the next step is to backward propagate the identity linear relationship through a linear layer h ( L ) ( x ) = W ( L ) g ( L−1 ) ( x ) to get the linear bounds of f ( x ) w.r.t g ( L−1 ) : W ( L ) g ( L−1 ) ( x ) ≤ f ( x ) ≤W ( L ) g ( L−1 ) ( x ) , x ∈ C ( 4 ) To get the linear relationship of h ( L−1 ) w.r.t f ( x ) , we need to backward propagate through ReLU layer g ( L−1 ) ( x ) = ReLU ( h ( L−1 ) ( x ) ) . Since it is nonlinear , we perform linear relaxations . For illustration , considering the j-th ReLU neuron at i-th layer , g ( i ) j ( x ) = ReLU ( h ( i ) j ( x ) ) , we can linearly upper and lower bound it by a ( i ) j h ( i ) j ( x ) + b ( i ) j ≤ g ( i ) j ( x ) ≤ a ( i ) j h ( i ) j ( x ) + b ( i ) j , where a ( i ) j , a ( i ) j , b ( i ) j , b ( i ) j are : a ( i ) j = a ( i ) j = 0 , b ( i ) j = b ( i ) j = 0 u ( i ) j ≤ 0 ( always inactive for x ∈ C ) a ( i ) j = a ( i ) j = 1 , b ( i ) j = b ( i ) j = 0 l ( i ) j ≥ 0 ( always active for x ∈ C ) a ( i ) j = α ( i ) j , a ( i ) j = u ( i ) j u ( i ) j −l ( i ) j , b ( i ) j = 0 , b ( i ) j = − u ( i ) j l ( i ) j u ( i ) j −l ( i ) j l ( i ) j < 0 , u ( i ) j > 0 ( unstable for x ∈ C ) ( 5 ) Here l ( i ) j ≤ h ( i ) j ( x ) ≤ u ( i ) j are intermediate pre-activation bounds for x ∈ C , and α ( i ) j is an arbitrary value between 0 and 1 . The pre-activation bounds l ( i ) j and u ( i ) j can be computed by treating h ( i ) j ( x ) as the output neuron with LiRPA . Figure 1 ( b , c , d ) illustrate the relaxation for each state of ReLU neuron . With these linear relaxations , we can get the linear equation of h ( L−1 ) w.r.t output f ( x ) : W ( L ) D ( L−1 ) α h ( L−1 ) ( x ) + b ( L ) ≤ f ( x ) ≤W ( L ) D ( L−1 ) α h ( L−1 ) ( x ) + b ( L ) , x ∈ C D ( L ) α , ( j , j ) = { a ( L ) j , W ( L ) j ≥ 0 a ( L ) j , W ( L ) j < 0 , b ( L ) = b′ ( L ) > W ( L ) , where b′ ( L ) j = { b ( L ) j , W ( L ) j ≥ 0 b ( L ) j , W ( L ) j < 0 ( 6 ) The diagonal matrices D ( L−1 ) α , D ( L−1 ) α and biases reflects the linear relaxations and also considers the signs in W ( L ) to maintain the lower and upper bounds . The definitions for j-th diagonal element D ( L ) α , ( j , j ) and bias b ( L ) are similar , with the conditions for checking the signs of W ( L ) j swapped . Importantly , D ( L−1 ) α has free variables α ( i ) j ∈ [ 0 , 1 ] which do not affect correctness of the bounds . We can continue backward propagating these bounds layer by layer ( e.g. , g ( L−2 ) ( x ) , h ( L−2 ) ( x ) , etc ) until reaching g ( 0 ) ( x ) = x , getting the eventual linear equations of f ( x ) in terms of input x : L ( x , α ) ≤ f ( x ) ≤ U ( x , α ) , ∀x ∈ C , where L ( x , α ) = W ( L ) D ( L−1 ) α · · ·D ( 1 ) α W ( 1 ) x+ b , U ( x , α ) = W ( L ) D ( L−1 ) α · · ·D ( 1 ) α W ( 1 ) x+ b ( 7 ) Hereα denotes α ( i ) j for all unstable ReLU neurons in NN . The obtained bounds ( L ( x , α ) , U ( x , α ) ) of f ( x ) are linear functions in terms of x . Beyond the simple feedforward NN presented here , LiRPA can support more complicated NN architectures like DenseNet and Transformers by computing L and U automatically and efficiently on general computational graphs ( Xu et al. , 2020 ) . Soundness of LiRPA The above backward bound propagation process guarantees that L ( x , α ) and U ( x , α ) soundly bound f ( x ) for all x ∈ C. Detailed proofs can be found in ( Zhang et al. , 2018 ; Singh et al. , 2019b ) for feedforward NNs and ( Xu et al. , 2020 ) for general networks .
The authors demonstrate that using a modification of the LiRPA method during the branch-and-bound process for solving the neural network verification problem can lead to significant speed-ups. The experimental results are strong. The authors convincingly show that the their method outperforms the existing state-of-the-art method by Lu & Kumar (2020) on an experimental setup similar to that work. The application of LiRPA to branch-and-bound is straightforward (since any incomplete verifier can be used), as is the use of gradient descent to improve the bound given by LiRPA (a standard technique applied to improve the bounds of certain verifiers).
SP:c0e79bbc34b390168a3bc07c2c1b410736100783
Fast and Complete: Enabling Complete Neural Network Verification with Rapid and Massively Parallel Incomplete Verifiers
1 INTRODUCTION . Although neural networks ( NNs ) have achieved great success on various complicated tasks , they remain susceptible to adversarial examples ( Szegedy et al. , 2013 ) : imperceptible perturbations of test samples might unexpectedly change the NN predictions . Therefore , it is crucial to conduct formal verification for NNs such that they can be adopted in safety or security-critical settings . Formally , the neural network verification problem can be cast into the following decision problem : Given a neural network f ( · ) , an input domain C , and a property P . ∀x ∈ C , does f ( x ) satisfy P ? The property P is typically a set of desirable outputs of the NN conditioned on the inputs . Typically , consider a binary classifier f ( x ) and a positive example x0 ( f ( x0 ) ≥ 0 ) , we can set P to be nonnegative numbers R+ and x is bounded within an l∞ norm ball C = { x|‖x − x0‖∞ ≤ } . The success of verification guarantees that the label of x0 can not flip for any perturbed inputs within C. In this paper we study the complete verification setting , where given sufficient time , the verifier should give a definite “ yes/no ” answer for a property under verification . In the above setting , it must solve the non-convex optimization problem minx∈C f ( x ) to a global minimum . Complete NN verification is generally a challenging NP-Hard problem ( Katz et al. , 2017 ) which usually requires expensive formal verification methods such as SMT ( Katz et al. , 2017 ) or MILP solvers ( Tjeng et al. , 2019b ) . On the other hand , incomplete solvers such as convex relaxations of NNs ( Salman et al. , 2019 ) can only provide a sound analysis , i.e. , they can only approximate the lower bound of minx∈C f ( x ) as f and verify the property when f ≥ 0 . No conclusion can be drawn when f < 0 . Recently , a Branch and Bound ( BaB ) style framework ( Bunel et al. , 2018 ; 2020b ) has been adopted for efficient complete verification . BaB solves the optimization problem minx∈C f ( x ) to a global minimum by branching into multiple sub-domains recursively and bounding the solution for each sub-domain using incomplete verifiers . BaB typically uses a Linear Programming ( LP ) bounding procedure as an incomplete verifier to provide feasibility checking and relatively tight bounds for each sub-domain . However , the relatively high solving cost of LPs and incapability of parallelization ( especially on massively parallel hardware accelerators like GPUs or TPUs ) greatly limit the performance and scalability of the existing complete BaB based verifiers . In this paper , we aim to use fast and typically weak incomplete verifiers for complete verification . Specifically , we focus on a class of incomplete verifiers using efficient bound propagation operations , referred to as linear relaxation based perturbation analysis ( LiRPA ) algorithms ( Xu et al. , 2020 ) . Representative algorithms in this class include convex outer adversarial polytope ( Wong & Kolter , 2018 ) , CROWN ( Zhang et al. , 2018 ) and DeepPoly ( Singh et al. , 2019b ) . LiRPA algorithms exhibit high parallelism as the bound propagation process is similar to forward or backward propagation of NNs , which can fully exploit machine learning accelerators ( e.g. , GPUs and TPUs ) . Although LiRPA bounds are very efficient for incomplete verification , especially in training certified adversarial defenses ( Wong et al. , 2018 ; Mirman et al. , 2018 ; Wang et al. , 2018a ; Zhang et al. , 2020 ) , they are generally considered too loose to be useful compared to LPs in the complete verification settings with BaB . As we will demonstrate later , using LiRPA bounds naively in BaB can not even guarantee the completeness when splitting ReLU nodes , and thus we need additional measures to make them useful for complete verification . In fact , LiRPA methods have been used to get upper and lower bounds for each ReLU neuron in constructing tighter LPs ( Bunel et al. , 2018 ; Lu & Kumar , 2020 ) . It was also used in ( Wang et al. , 2018c ) for verifying small-scale problems with relatively low dimensional input domains using input splits , but splitting the input space can be quite ineffective ( Bunel et al. , 2018 ) and is unable to scale to high dimensional input case like CIFAR-10 . Except one concurrent work ( Bunel et al. , 2020a ) , most complete verifiers are based on relatively expensive solvers like LP and can not fully take benefit from massively parallel hardware ( e.g. , GPUs ) to obtain tight bounds for accelerating large-scale complete verification problems . Our main contributions are : • We show that LiRPA bounds , when improved with fast gradient optimizers , can potentially outperform bounds obtained by LP verifiers . This is because LiRPA allows joint optimization of both intermediate layer bounds of ReLU neurons ( which determine the tightness of relaxation ) and output bounds , while LP can only optimize output bounds with fixed relaxations on ReLU neurons . • We show that BaB purely using LiRPA bounds is insufficient for complete verification due to the lack of feasibility checking for ReLU node splits . To address this issue , we design our algorithm to only invoke LP when absolutely necessary and exploits hardware parallelism when possible . • To fully exploit the hardware parallelism on the machine learning accelerators , we use a batch splitting approach that splits on multiple neurons simultaneously , further improving our efficiency . • On a few standard and representative benchmarks , our proposed NN verification framework can outperform previous baselines significantly , with a speedup of around 30X compared to basic BaB+LP baselines , and up to 3X compared to recent state-of-the-art complete verifiers . 2 BACKGROUND . 2.1 FORMAL DEFINITION OF NEURAL NETWORK ( NN ) VERIFICATION . Notations of NN . For illustration , we define an L-layer feedforward NN f : R|x| → R with L weights W ( i ) ( i ∈ { 1 , · · · , L } ) recursively as h ( i ) ( x ) = W ( i ) g ( i−1 ) ( x ) , hidden layer g ( i ) ( x ) = ReLU ( h ( i ) ( x ) ) , input layer g ( 0 ) ( x ) = x , and final output f ( x ) = h ( L ) ( x ) . For simplicity we ignore biases . We sometimes omit x and use h ( i ) j to represent the pre-activation of the j-th ReLU neuron in i-th layer for x ∈ C , and we use g ( i ) j to represent the post-activation value . We focus on verifying ReLU based NNs , but our method is generalizable to other activation functions supported by LiRPA . NN Verification Problem . Given an input x , its bounded input domain C , and a feedforward NN f ( · ) , the aim of formal verification is to prove or disprove certain properties P of NN outputs . Since most properties studied in previous works can be expressed as a Boolean expression over a linear equation of network output , where the linear property can be merged into the last layer weights of a NN , the ultimate goal of complete verification reduces to prove or disprove : ∀x ∈ C , f ( x ) ≥ 0 ( 1 ) One way to prove Eq . 1 is to solve minx∈C f ( x ) . Due to the non-convexity of NNs , finding the exact minimum of f ( x ) over x ∈ C is challenging as the optimization process is generally NPcomplete ( Katz et al. , 2017 ) . However , in practice , a sound approximation of the lower bound for f ( x ) , denoted as f , can be more easily obtained and is sufficient to verify the property . Thus , a good verification strategy to get a tight approximation f can save significant time cost . Note that f must be sound , i.e. , ∀x ∈ C , f ≤ f ( x ) , proving f ≥ 0 is sufficient to prove the property f ( x ) ≥ 0 . 2.2 THE BRANCH AND BOUND ( BAB ) FRAMEWORK FOR NEURAL NETWORK VERIFICATION . Branch and Bound ( BaB ) , an effective strategy in solving traditional combinatorial optimization problems , has been customized and widely adopted for NN verification ( Bunel et al. , 2018 ; 2020b ) . Specifically , BaB based verification framework is a recursive process , consisting of two main steps : branching and bounding . For branching , BaB based methods will divide the bounded input domain C into sub-domains { Ci|C = ⋃ i Ci } , each defined as a new independent verification problem . For instance , it can split a ReLU unit g ( k ) j = ReLU ( h ( k ) j ) to be negative and positive cases as C0 = C ∩ ( h ( k ) j ≥ 0 ) and C1 = C ∩ ( h ( k ) j < 0 ) for a ReLU-based network ; for each sub-domain Ci , BaB based methods perform bounding to obtain a relaxed but sound lower bound fCi . A tightened global lower bound over C can then be obtained by taking the minimum values of the sub-domain lower bounds from all the sub-domains : f = mini fCi . Branching and bounding will be performed recursively to tighten the approximated global lower bound over C until either ( 1 ) the global lower bound f becomes larger than 0 and prove the property or ( 2 ) a violation ( e.g. , adversarial example ) is located in a sub-domain to disprove the property . Essentially , we build a search tree where each leaf is a sub-domain , and the property P can be proven only when it is valid on all leaves . Soundness of BaB We say the verification process is sound if we can always trust the “ yes ” ( P is verified ) answer given by the verifier . It is straightforward to see that the whole BaB based verification process is sound as long as the bounding method used for each sub-domain Ci is sound . Completeness of BaB The completeness of the BaB-based NN verification process , which was usually assumed true in some previous works ( Bunel et al. , 2020b ; 2018 ) , in fact , is not always true even if all possible sub-domains are considered with a sound bounding method . Additional requirements for the bounding method are required - we point out that a key factor for completeness involves feasibility checking in the bounding method which we will discuss in Section 3.2 . Branching in BaB Since branching step determines the shape of the search tree , the main challenge is to efficiently choose a good leaf to split , which can significantly reduce the total number of branches and running time . In this work we focus on branching on activation ( ReLU ) nodes . BaBSR ( Bunel et al. , 2018 ) includes a simple branching heuristic which assigns each ReLU node a score to estimate the improvement for tightening f by splitting it , and splits the node with the highest score . Bounding with Linear Programming ( LP ) A typical bounding method used in BaB based verification is the Linear Programming bounding procedure ( sometimes simply referred to as “ LP ” or “ LP verifier ” in our paper ) . Specifically , we transform the original verification problem into a linear programming problem by relaxing every activation unit as a convex ( linear ) domain ( Ehlers , 2017 ) and then get the lower bound fCi with a linear solver given domain Ci . For instance , as shown in Figure 1a , g ( i ) j = ReLU ( h ( i ) j ) can be linearly relaxed with the following 3 constraints : ( 1 ) g ( i ) j ≥ h ( i ) j ; ( 2 ) g ( i ) j ≥ 0 ; ( 3 ) g ( i ) j ≤ u ( i ) j u ( i ) j −l ( i ) j ( h ( i ) j − l ( i ) j ) . Note that the lower bound l ( i ) j and upper bound u ( i ) j for each activation node h ( i ) j are required in the LP construction given Ci . They are typically computed by the existing cheap bounding methods like LiRPA variants ( Wong & Kolter , 2018 ) with low cost . The tighter the intermediate bounds ( l ( i ) j , u ( i ) j ) are , the tighter f approximated by LP is . 2.3 LINEAR RELAXATION BASED PERTURBATION ANALYSIS ( LiRPA ) Bound propagation in LiRPA We used Linear Relaxation based Perturbation Analysis ( LiRPA ) 1 as bound procedure in BaB to get linear upper and lower bounds of NN output w.r.t input x ∈ C : Ax+ b ≤ f ( x ) ≤ Ax+ b , x ∈ C ( 2 ) 1We only use the backward mode LiRPA bounds ( e.g. , CROWN and DeepPoly ) in this paper . l ( i ) j u ( i ) j x ( i ) j h ( i ) j A lower bound f can then be simply obtained by taking the lower bound of the linear equation Ax+ b w.r.t input x ∈ C , which can be obtained via Hölder ’ s inequality when C is a ` p norm ball . To get the coefficients A , A , b , b , LiRPA propagates bounds of f ( x ) as a linear function to the output of each layer , in a backward manner . At the output layer h ( L ) ( x ) we simply have : Ih ( L ) ( x ) ≤ f ( x ) ≤ Ih ( L ) ( x ) , x ∈ C ( 3 ) Then , the next step is to backward propagate the identity linear relationship through a linear layer h ( L ) ( x ) = W ( L ) g ( L−1 ) ( x ) to get the linear bounds of f ( x ) w.r.t g ( L−1 ) : W ( L ) g ( L−1 ) ( x ) ≤ f ( x ) ≤W ( L ) g ( L−1 ) ( x ) , x ∈ C ( 4 ) To get the linear relationship of h ( L−1 ) w.r.t f ( x ) , we need to backward propagate through ReLU layer g ( L−1 ) ( x ) = ReLU ( h ( L−1 ) ( x ) ) . Since it is nonlinear , we perform linear relaxations . For illustration , considering the j-th ReLU neuron at i-th layer , g ( i ) j ( x ) = ReLU ( h ( i ) j ( x ) ) , we can linearly upper and lower bound it by a ( i ) j h ( i ) j ( x ) + b ( i ) j ≤ g ( i ) j ( x ) ≤ a ( i ) j h ( i ) j ( x ) + b ( i ) j , where a ( i ) j , a ( i ) j , b ( i ) j , b ( i ) j are : a ( i ) j = a ( i ) j = 0 , b ( i ) j = b ( i ) j = 0 u ( i ) j ≤ 0 ( always inactive for x ∈ C ) a ( i ) j = a ( i ) j = 1 , b ( i ) j = b ( i ) j = 0 l ( i ) j ≥ 0 ( always active for x ∈ C ) a ( i ) j = α ( i ) j , a ( i ) j = u ( i ) j u ( i ) j −l ( i ) j , b ( i ) j = 0 , b ( i ) j = − u ( i ) j l ( i ) j u ( i ) j −l ( i ) j l ( i ) j < 0 , u ( i ) j > 0 ( unstable for x ∈ C ) ( 5 ) Here l ( i ) j ≤ h ( i ) j ( x ) ≤ u ( i ) j are intermediate pre-activation bounds for x ∈ C , and α ( i ) j is an arbitrary value between 0 and 1 . The pre-activation bounds l ( i ) j and u ( i ) j can be computed by treating h ( i ) j ( x ) as the output neuron with LiRPA . Figure 1 ( b , c , d ) illustrate the relaxation for each state of ReLU neuron . With these linear relaxations , we can get the linear equation of h ( L−1 ) w.r.t output f ( x ) : W ( L ) D ( L−1 ) α h ( L−1 ) ( x ) + b ( L ) ≤ f ( x ) ≤W ( L ) D ( L−1 ) α h ( L−1 ) ( x ) + b ( L ) , x ∈ C D ( L ) α , ( j , j ) = { a ( L ) j , W ( L ) j ≥ 0 a ( L ) j , W ( L ) j < 0 , b ( L ) = b′ ( L ) > W ( L ) , where b′ ( L ) j = { b ( L ) j , W ( L ) j ≥ 0 b ( L ) j , W ( L ) j < 0 ( 6 ) The diagonal matrices D ( L−1 ) α , D ( L−1 ) α and biases reflects the linear relaxations and also considers the signs in W ( L ) to maintain the lower and upper bounds . The definitions for j-th diagonal element D ( L ) α , ( j , j ) and bias b ( L ) are similar , with the conditions for checking the signs of W ( L ) j swapped . Importantly , D ( L−1 ) α has free variables α ( i ) j ∈ [ 0 , 1 ] which do not affect correctness of the bounds . We can continue backward propagating these bounds layer by layer ( e.g. , g ( L−2 ) ( x ) , h ( L−2 ) ( x ) , etc ) until reaching g ( 0 ) ( x ) = x , getting the eventual linear equations of f ( x ) in terms of input x : L ( x , α ) ≤ f ( x ) ≤ U ( x , α ) , ∀x ∈ C , where L ( x , α ) = W ( L ) D ( L−1 ) α · · ·D ( 1 ) α W ( 1 ) x+ b , U ( x , α ) = W ( L ) D ( L−1 ) α · · ·D ( 1 ) α W ( 1 ) x+ b ( 7 ) Hereα denotes α ( i ) j for all unstable ReLU neurons in NN . The obtained bounds ( L ( x , α ) , U ( x , α ) ) of f ( x ) are linear functions in terms of x . Beyond the simple feedforward NN presented here , LiRPA can support more complicated NN architectures like DenseNet and Transformers by computing L and U automatically and efficiently on general computational graphs ( Xu et al. , 2020 ) . Soundness of LiRPA The above backward bound propagation process guarantees that L ( x , α ) and U ( x , α ) soundly bound f ( x ) for all x ∈ C. Detailed proofs can be found in ( Zhang et al. , 2018 ; Singh et al. , 2019b ) for feedforward NNs and ( Xu et al. , 2020 ) for general networks .
This paper describes a branch-and-bound (BaB) process for neural network verification that uses linear relaxation based perturbation analysis (LiRPA). It gives a way to tighten the bounds obtained via LiRPA. Overall, this results is a complete verification procedure, which is an order of magnitude faster than existing linear programming (LP) procedures.
SP:c0e79bbc34b390168a3bc07c2c1b410736100783
Predictive Attention Transformer: Improving Transformer with Attention Map Prediction
1 INTRODUCTION . Transformer ( Vaswani et al. , 2017 ) is the state-of-the-art for sequential modeling which achieves superior performances in multiple domains , including natural language understanding ( Devlin et al. , 2019 ) , image generation ( Parmar et al. , 2018 ) and time-series forecasting ( Li et al. , 2019 ) . The performance of a transformer model largely depends on its capability of inducing reasonable dependencies among input tokens . However , as demonstrated by previous work ( Jain & Wallace , 2019 ) , it is difficult for a vanilla attention layer to capture the dependencies effectively without any apriori knowledge . To cope with this problem , recent efforts have tried to address the effectiveness of attention learning , such as concatenating self-attention with CNN layers to obtain a better representation ( Bello et al. , 2019 ; Wu et al. , 2020 ) , or synthesizing the attention maps directly ( Tay et al. , 2020 ) . In this paper , we consider another question , can we improve the learning of attention maps via a dedicated prediction model ? As we will see , it is possible through augmenting the transformer architecture by a chain of convolutional modules for attention map prediction . For a multi-layer transformer , the self-attention maps in each layer are learned independently , which introduces a huge amount of parameters and hurts the generalization ability . Our motivation is that we can bridge the attention maps from different layers , while a succeeding layer can take the knowledge from previous layers directly to induce a better dependency structure . To this end , we propose Predictive Attention Transformer ( PA-Transformer ) , which guides the learning of attention maps via a chain of convolution-based prediction modules . In each block , PA-Transformer takes all attention maps generated by the previous block as a multi-channel image . Then , by performing 2D-convolution over that image , the attention maps for the current block can be predicted effectively and efficiently . In this way , the general patterns of inter-token dependencies are shared across all blocks , benefiting the generalization ability of a multi-layer Transformer . Meanwhile , the selfattention layer in each block is guided by the predicted attention patterns and can be learned to capture complementary relationships . As shown by a real case of image classification in Figure 1 ( b ) , the attention map learned in the second PA-Transformer block correctly highlights the structure of a horse with the help of inherited knowledge from previous layers . Specifically , the convolution-based attention prediction module captures key patterns from a local perspective ( probably owning to the convolutional inductive bias ) , which guides the residual self-attention module to generated better attention maps . In contrast , the vanilla transformer learns each self-attention layer separately and does not produce good attention maps ( see Figure 1 ( a ) ) . We evaluate the performance of PA-Transformer on plenty of tasks in both natural language and computer vision domains , including text classification , natural language inference , machine translation and image classification . We also apply the generic idea of attention map prediction to other state-of-the-art models such as BERT ( Devlin et al. , 2019 ) and AA-ResNet ( Bello et al. , 2019 ) . The experimental results demonstrate the superiority of PA-enhanced transformers in terms of accuracy , memory and computational costs . In particular , for ImageNet classification task , PA-AA-ResNets achieve strong accuracy improvement on top of AA-ResNet ( Bello et al. , 2019 ) , a recent SOTA which has already encapsulated self-attention and convolutional layers jointly for image representation . Moreover , we examine the generality of PA-Transformer by incorporating it into BERT-style pre-trained models . Impressively , the average GLUE scores are lifted by 4.1 , 2.5 , 0.8 and 1.3 points on top of BERT-Base , BERT-Large , RoBERTa-Large and T5-Base respectively , while little extra parameters and computational costs are introduced to the original models . The contributions of this paper are highlighted as follows . • In this paper , we propose a novel Transformer architecture augmented by a chain of convolutional attention prediction models . Extensive experiments demonstrate consistent performance enhancement for various natural language and computer vision tasks . • Ablation study proves the effectiveness of both residual connections among attention maps and convolutional inductive bias to induce better attention patterns . To the best of our knowledge , PA-Transformer is one of the first works that take attention maps as multichannel input to a deep neural network for explicit modeling . This sheds new lights on the attention mechanism . • We empirically show that the proposed PA-enhanced method is complementary to existing works on transformer , including those pre-trained by a large corpus and enhanced by CNN layers . Thus , we believe it will have further impacts to more advanced model architectures and a broader range of applications . 2 RELATED WORK . Transformer is first introduced by Vaswani et al . ( 2017 ) for machine translation and then widely adopted in numerous tasks in natural language ( Devlin et al. , 2019 ) , computer vision ( Parmar et al. , 2018 ; 2019 ) and time-series ( Li et al. , 2019 ) domains . Transformer is solely composed of selfattention and feed-forward layers . It is much more parallelizable than Recurrent Neural Networks ( RNNs ) and demonstrates extreme superiority in large-scale training scenarios . Most notably , the cutting-edge text representation model , BERT ( Devlin et al. , 2019 ) , is based on an architecture of deep bidirectional Transformer . After pre-trained on a large-scale language corpus through the “ masked language model ” ( MLM ) loss , BERT can be fine-tuned with just one additional output layer to create state-of-the-art performances for a wide range of text-based applications . The assumption behind Transformer is that the intra-sequence relationships can be captured automatically through self-attention . But in practice , it is questionable if a self-attention layer learns reasonable dependencies among input tokens . There are many endeavors trying to analyze attention maps generated by the attention mechanism . Raganato et al . ( 2018 ) analyze the Transformer model for machine translation and show that some attention heads capture certain relations implicitly : lower layers tend to learn more about syntax while higher layers tend to encode more about semantics . As suggested by Tang et al . ( 2018 ) , the ability of inducing syntactic relations for a Transformer model is weaker than its recurrent neural network counterpart . There is a debate on whether or not the intermediate representations offered by attention mechanisms may be useful to explain the reasons for a model ’ s prediction ( Jain & Wallace , 2019 ; Wiegreffe & Pinter , 2019 ) . Moreover , Synthesizer ( Tay et al. , 2020 ) develops a strategy to replace the dot-product attention by synthesized attention maps . It is argued that explicit token-token interaction is not that important . In short , the attention maps learned by existing attention models are far from perfect , which motivates us to propose a dedicated model for extracting attention patterns . Besides , there have been successful attempts to combine convolutional and self-attention layers to enrich image and text representations ( Bello et al. , 2019 ; Wu et al. , 2020 ) . However , to the best of our knowledge , our work is one of the first that takes attention maps as multi-channel inputs and utilizes a dedicated deep neural network model for explicit modeling . We believe this is a promising direction that deserves more investigations in the future . Another limitation of Transformer lies in its prohibition for modeling long sequences , as both the memory and computation complexities are quadratic to the sequence length . To address this problem , Kitaev et al . ( 2020 ) propose Reformer which utilizes two techniques to improve the efficiency of Transformers : ( 1 ) revising dot-product attention with locality-sensitive hashing ; ( 2 ) replacing residual layers with reversible ones . Moreover , Gehring et al . ( 2017 ) leverage an architecture based entirely on convolutional neural networks for sequence to sequence learning , where the number of non-linearities is fixed and independent of the input length . Parmar et al . ( 2019 ) apply stand-alone self-attention layers to image classification by restricting the attention operations within a local region of pixels . In addition , there are other directions in the literature for the improvement of a Transformer model , such as relative positional representations ( Shaw et al. , 2018 ) , adaptive masks for long-range information ( Sukhbaatar et al. , 2019 ) , tree-based transformer ( Shiv & Quirk , 2019 ) , and AutoML-based evolved transformer ( So et al. , 2019 ) . These works are orthogonal to ours , and most of them can be encapsulated in our framework freely . 3 PREDICTIVE ATTENTION TRANSFORMER . 3.1 OVERVIEW . The representation of a text sequence can be written as X ∈ RN×C , where N denotes the sequence length and C is the dimension size . For an image representation , the conventional shape is ( H , W , C ) , where H , W and C denote height , width and channel size of the image respectively . In order to apply a standard Transformer to the image representation , we flatten its shape as X ∈ RN×C , where N = HW and each pixel serves as an individual token in the Transformer . A standard Transformer block is composed of a self-attention layer and two position-wise feedforward layers , while each attention map is generated by a self-attention layer separately without sharing information with each other . We argue that a single and independent self-attention layer is not generalizable to capture the underlying dependencies among tokens . To alleviate this prob- lem , we propose a convolution-based prediction module that calculates attention maps for the current layer based on the attention map from the previous layer . Our conjecture is that this module would predict effective attention maps in the guidance of generalized attention patterns from previous layers . Thus , the self-attention module in the current layer could dedicate itself to incorporate layer-specific knowledge into residual attention maps . We name the transformer network with proposed augmentation as Predictive Attention Transformer ( PA-Transformer ) , the architecture of which is illustrated in Figure 1 ( b ) . Each PA-Transformer block consists of three modules as a standard transformer , namely Attention Map Generation , Value Projection and Feed-Forward Layers . In addition , there are Convolution-based Attention Prediction modules , which take the attention maps from the previous block as input to predict the ones in the next block through convolutional neural networks . Note that Attention Map Generation and Value Projection are two sub-modules of a standard self-attention layer . We omit layer norm and residual connections in the figure for brevity . In the rest of this section , we will introduce the details of each module separately . 3.2 ATTENTION MAP GENERATION . Given the input representation X , the attention map can be calculated as follows . First , we compute the query and key matrices for each attention head through linear projections , i.e. , Q = XWQ , K = XWK , where Q and K denote query and key matrices respectively , WQ and WK are linear projection parameters . Then , the attention map is derived by a scaled dot-product operation : A =Attention ( X ) = softmax ( QK > √ d ) ( 1 ) Here A denotes the attention map and d is the hidden dimension size . To inject sequential information into the model , we incorporate positional encoding to the input representation . The positional encoding can be either absolute or relative , and we follow the original implementation for different backbone models . For absolute positional encoding ( Vaswani et al. , 2017 ) , it is added to the input representation X directly . For relative positional representation ( Shaw et al. , 2018 ) , the attention formulation can be re-written as : A =Attention ( X ) = softmax ( QK > √ d +R ) ( 2 ) where R = { rij } is the matrix of relative positional encoding . For text data , we have rij = qTi ei−j , where ei−j is a trainable embedding vector in terms of the relative index of two tokens . For image data , we adopt two separate embedding vectors for height and width ( Bello et al. , 2019 ) . rij = q > i e H h ( j ) −h ( i ) + q > i e W w ( j ) −w ( i ) ( 3 ) where qi is the query representation for the ith pixel , eH and eW represent for trainable embedding vectors of height and width respectively , h ( i ) and h ( j ) are the height indices for the ith and jth pixels , and w ( · ) denotes the index in width .
This paper proposed a modification to the classical transformer architecture and demonstrated significant performance gain on multiple benchmark tasks in both natural language processing and computer vision. Specifically, the authors propose to introduce a convolution-based attention map prediction module, so the dependencies of attention maps across different layers can be captured. With the extensive experiments, the proposed modification is quite effective on improving the model's performance.
SP:5c679af56d9947de1b793665b4c4eb952a672f0a
Predictive Attention Transformer: Improving Transformer with Attention Map Prediction
1 INTRODUCTION . Transformer ( Vaswani et al. , 2017 ) is the state-of-the-art for sequential modeling which achieves superior performances in multiple domains , including natural language understanding ( Devlin et al. , 2019 ) , image generation ( Parmar et al. , 2018 ) and time-series forecasting ( Li et al. , 2019 ) . The performance of a transformer model largely depends on its capability of inducing reasonable dependencies among input tokens . However , as demonstrated by previous work ( Jain & Wallace , 2019 ) , it is difficult for a vanilla attention layer to capture the dependencies effectively without any apriori knowledge . To cope with this problem , recent efforts have tried to address the effectiveness of attention learning , such as concatenating self-attention with CNN layers to obtain a better representation ( Bello et al. , 2019 ; Wu et al. , 2020 ) , or synthesizing the attention maps directly ( Tay et al. , 2020 ) . In this paper , we consider another question , can we improve the learning of attention maps via a dedicated prediction model ? As we will see , it is possible through augmenting the transformer architecture by a chain of convolutional modules for attention map prediction . For a multi-layer transformer , the self-attention maps in each layer are learned independently , which introduces a huge amount of parameters and hurts the generalization ability . Our motivation is that we can bridge the attention maps from different layers , while a succeeding layer can take the knowledge from previous layers directly to induce a better dependency structure . To this end , we propose Predictive Attention Transformer ( PA-Transformer ) , which guides the learning of attention maps via a chain of convolution-based prediction modules . In each block , PA-Transformer takes all attention maps generated by the previous block as a multi-channel image . Then , by performing 2D-convolution over that image , the attention maps for the current block can be predicted effectively and efficiently . In this way , the general patterns of inter-token dependencies are shared across all blocks , benefiting the generalization ability of a multi-layer Transformer . Meanwhile , the selfattention layer in each block is guided by the predicted attention patterns and can be learned to capture complementary relationships . As shown by a real case of image classification in Figure 1 ( b ) , the attention map learned in the second PA-Transformer block correctly highlights the structure of a horse with the help of inherited knowledge from previous layers . Specifically , the convolution-based attention prediction module captures key patterns from a local perspective ( probably owning to the convolutional inductive bias ) , which guides the residual self-attention module to generated better attention maps . In contrast , the vanilla transformer learns each self-attention layer separately and does not produce good attention maps ( see Figure 1 ( a ) ) . We evaluate the performance of PA-Transformer on plenty of tasks in both natural language and computer vision domains , including text classification , natural language inference , machine translation and image classification . We also apply the generic idea of attention map prediction to other state-of-the-art models such as BERT ( Devlin et al. , 2019 ) and AA-ResNet ( Bello et al. , 2019 ) . The experimental results demonstrate the superiority of PA-enhanced transformers in terms of accuracy , memory and computational costs . In particular , for ImageNet classification task , PA-AA-ResNets achieve strong accuracy improvement on top of AA-ResNet ( Bello et al. , 2019 ) , a recent SOTA which has already encapsulated self-attention and convolutional layers jointly for image representation . Moreover , we examine the generality of PA-Transformer by incorporating it into BERT-style pre-trained models . Impressively , the average GLUE scores are lifted by 4.1 , 2.5 , 0.8 and 1.3 points on top of BERT-Base , BERT-Large , RoBERTa-Large and T5-Base respectively , while little extra parameters and computational costs are introduced to the original models . The contributions of this paper are highlighted as follows . • In this paper , we propose a novel Transformer architecture augmented by a chain of convolutional attention prediction models . Extensive experiments demonstrate consistent performance enhancement for various natural language and computer vision tasks . • Ablation study proves the effectiveness of both residual connections among attention maps and convolutional inductive bias to induce better attention patterns . To the best of our knowledge , PA-Transformer is one of the first works that take attention maps as multichannel input to a deep neural network for explicit modeling . This sheds new lights on the attention mechanism . • We empirically show that the proposed PA-enhanced method is complementary to existing works on transformer , including those pre-trained by a large corpus and enhanced by CNN layers . Thus , we believe it will have further impacts to more advanced model architectures and a broader range of applications . 2 RELATED WORK . Transformer is first introduced by Vaswani et al . ( 2017 ) for machine translation and then widely adopted in numerous tasks in natural language ( Devlin et al. , 2019 ) , computer vision ( Parmar et al. , 2018 ; 2019 ) and time-series ( Li et al. , 2019 ) domains . Transformer is solely composed of selfattention and feed-forward layers . It is much more parallelizable than Recurrent Neural Networks ( RNNs ) and demonstrates extreme superiority in large-scale training scenarios . Most notably , the cutting-edge text representation model , BERT ( Devlin et al. , 2019 ) , is based on an architecture of deep bidirectional Transformer . After pre-trained on a large-scale language corpus through the “ masked language model ” ( MLM ) loss , BERT can be fine-tuned with just one additional output layer to create state-of-the-art performances for a wide range of text-based applications . The assumption behind Transformer is that the intra-sequence relationships can be captured automatically through self-attention . But in practice , it is questionable if a self-attention layer learns reasonable dependencies among input tokens . There are many endeavors trying to analyze attention maps generated by the attention mechanism . Raganato et al . ( 2018 ) analyze the Transformer model for machine translation and show that some attention heads capture certain relations implicitly : lower layers tend to learn more about syntax while higher layers tend to encode more about semantics . As suggested by Tang et al . ( 2018 ) , the ability of inducing syntactic relations for a Transformer model is weaker than its recurrent neural network counterpart . There is a debate on whether or not the intermediate representations offered by attention mechanisms may be useful to explain the reasons for a model ’ s prediction ( Jain & Wallace , 2019 ; Wiegreffe & Pinter , 2019 ) . Moreover , Synthesizer ( Tay et al. , 2020 ) develops a strategy to replace the dot-product attention by synthesized attention maps . It is argued that explicit token-token interaction is not that important . In short , the attention maps learned by existing attention models are far from perfect , which motivates us to propose a dedicated model for extracting attention patterns . Besides , there have been successful attempts to combine convolutional and self-attention layers to enrich image and text representations ( Bello et al. , 2019 ; Wu et al. , 2020 ) . However , to the best of our knowledge , our work is one of the first that takes attention maps as multi-channel inputs and utilizes a dedicated deep neural network model for explicit modeling . We believe this is a promising direction that deserves more investigations in the future . Another limitation of Transformer lies in its prohibition for modeling long sequences , as both the memory and computation complexities are quadratic to the sequence length . To address this problem , Kitaev et al . ( 2020 ) propose Reformer which utilizes two techniques to improve the efficiency of Transformers : ( 1 ) revising dot-product attention with locality-sensitive hashing ; ( 2 ) replacing residual layers with reversible ones . Moreover , Gehring et al . ( 2017 ) leverage an architecture based entirely on convolutional neural networks for sequence to sequence learning , where the number of non-linearities is fixed and independent of the input length . Parmar et al . ( 2019 ) apply stand-alone self-attention layers to image classification by restricting the attention operations within a local region of pixels . In addition , there are other directions in the literature for the improvement of a Transformer model , such as relative positional representations ( Shaw et al. , 2018 ) , adaptive masks for long-range information ( Sukhbaatar et al. , 2019 ) , tree-based transformer ( Shiv & Quirk , 2019 ) , and AutoML-based evolved transformer ( So et al. , 2019 ) . These works are orthogonal to ours , and most of them can be encapsulated in our framework freely . 3 PREDICTIVE ATTENTION TRANSFORMER . 3.1 OVERVIEW . The representation of a text sequence can be written as X ∈ RN×C , where N denotes the sequence length and C is the dimension size . For an image representation , the conventional shape is ( H , W , C ) , where H , W and C denote height , width and channel size of the image respectively . In order to apply a standard Transformer to the image representation , we flatten its shape as X ∈ RN×C , where N = HW and each pixel serves as an individual token in the Transformer . A standard Transformer block is composed of a self-attention layer and two position-wise feedforward layers , while each attention map is generated by a self-attention layer separately without sharing information with each other . We argue that a single and independent self-attention layer is not generalizable to capture the underlying dependencies among tokens . To alleviate this prob- lem , we propose a convolution-based prediction module that calculates attention maps for the current layer based on the attention map from the previous layer . Our conjecture is that this module would predict effective attention maps in the guidance of generalized attention patterns from previous layers . Thus , the self-attention module in the current layer could dedicate itself to incorporate layer-specific knowledge into residual attention maps . We name the transformer network with proposed augmentation as Predictive Attention Transformer ( PA-Transformer ) , the architecture of which is illustrated in Figure 1 ( b ) . Each PA-Transformer block consists of three modules as a standard transformer , namely Attention Map Generation , Value Projection and Feed-Forward Layers . In addition , there are Convolution-based Attention Prediction modules , which take the attention maps from the previous block as input to predict the ones in the next block through convolutional neural networks . Note that Attention Map Generation and Value Projection are two sub-modules of a standard self-attention layer . We omit layer norm and residual connections in the figure for brevity . In the rest of this section , we will introduce the details of each module separately . 3.2 ATTENTION MAP GENERATION . Given the input representation X , the attention map can be calculated as follows . First , we compute the query and key matrices for each attention head through linear projections , i.e. , Q = XWQ , K = XWK , where Q and K denote query and key matrices respectively , WQ and WK are linear projection parameters . Then , the attention map is derived by a scaled dot-product operation : A =Attention ( X ) = softmax ( QK > √ d ) ( 1 ) Here A denotes the attention map and d is the hidden dimension size . To inject sequential information into the model , we incorporate positional encoding to the input representation . The positional encoding can be either absolute or relative , and we follow the original implementation for different backbone models . For absolute positional encoding ( Vaswani et al. , 2017 ) , it is added to the input representation X directly . For relative positional representation ( Shaw et al. , 2018 ) , the attention formulation can be re-written as : A =Attention ( X ) = softmax ( QK > √ d +R ) ( 2 ) where R = { rij } is the matrix of relative positional encoding . For text data , we have rij = qTi ei−j , where ei−j is a trainable embedding vector in terms of the relative index of two tokens . For image data , we adopt two separate embedding vectors for height and width ( Bello et al. , 2019 ) . rij = q > i e H h ( j ) −h ( i ) + q > i e W w ( j ) −w ( i ) ( 3 ) where qi is the query representation for the ith pixel , eH and eW represent for trainable embedding vectors of height and width respectively , h ( i ) and h ( j ) are the height indices for the ith and jth pixels , and w ( · ) denotes the index in width .
This paper proposes a novel approach to improve self-attention through by bridging the attention maps from different layers via a chain of convolution-based prediction modules. In particular, it proposes to augment the existing works on Transformer through supplementary prediction modules by CNN-based attention prediction layers. The main contribution of this paper is the introduction of CNN-based attention prediction to enhance model predictions. Empirical studies are performed to show the superiority of the proposed model PA-Transformer over several SOTA approaches on NLP and image classification tasks.
SP:5c679af56d9947de1b793665b4c4eb952a672f0a
Lie Algebra Convolutional Neural Networks with Automatic Symmetry Extraction
Many machine learning ( ML ) tasks involve data from unfamiliar domains , which may or may not have hidden symmetries . While much of the work on equivariant neural networks focuses on equivariant architectures , the ability of the architecture to discover symmetries in a given dataset is less studied . Convolutional Neural Networks ( CNN ) ( LeCun et al. , 1989 ; 1998 ) incorporate translation symmetry into the architecture . Recently , more general ways to construct equivariant architectures have been introduced ( Cohen & Welling , 2016a ; b ; Cohen et al. , 2018 ; Kondor & Trivedi , 2018 ) . Encoding equivariance into an ML architecture can reduce data requirements and improve generalization , while significantly reducing the number of model parameters via parameter sharing ( Cohen et al. , 2019 ; Cohen & Welling , 2016b ; Ravanbakhsh et al. , 2017 ; Ravanbakhsh , 2020 ) . As a result , many other symmetries such as discrete rotations in 2D ( Veeling et al. , 2018 ; Marcos et al. , 2017 ) and 3D ( Cohen et al. , 2018 ; Cohen & Welling , 2016a ) as well as permutations ( Zaheer et al. , 2017 ) have been incorporated into the architecture of neural networks . Many existing works on equivariant architectures use finite groups such as permutations in Hartford et al . ( 2018 ) and Ravanbakhsh et al . ( 2017 ) or discrete subgroups of continuous groups , such as 90 degree rotations in ( Cohen et al. , 2018 ) or dihedral groups DN in Weiler & Cesa ( 2019 ) . Ravanbakhsh ( 2020 ) also proved a universal approximation theorem for single hidden layer equivariant neural networks for Abelian and finite groups . General principles for constructing group convolutional layers were introduced in Cohen & Welling ( 2016b ) , Kondor & Trivedi ( 2018 ) , and Cohen et al . ( 2019 ) , including for continuous groups . A challenge for implementation is having to integrate over the group manifold . This has been remedied either by generalizing Fast Fourier Transforms ( Cohen et al. , 2018 ) , or using irreducible representations ( irreps ) ( Weiler et al. , 2018a ) either directly as spherical harmonics as in Worrall et al . ( 2017 ) or using more general Clebsch-Gordon coefficients ( Kondor et al. , 2018 ) . Other approaches include discretizing the group as in Weiler et al . ( 2018a ; b ) ; Cohen & Welling ( 2016a ) , or solving constraints for equivariant irreps as in Weiler & Cesa ( 2019 ) , or approximating the integral by sampling ( Finzi et al. , 2020 ) . The limitations in all of the approaches above are that : 1 ) they rely on knowing the symmetry group a priori , and 2 ) require encoding the whole group into the architecture . For a continuous group , it is not possible to encode all elements and we have to resort to discretization or a truncated sum over irreps . Our work attempts to resolve the issues with continuous groups by using the Lie algebra ( the linearization of the group near its identity ) instead of the group itself . Unlike the Lie group which is infinite , the Lie algebra usually has a finite basis ( notable exception being Kac-Moody Lie algebras for 2D Conformal Field Theories ( Belavin et al. , 1984 ) in physics ) . Additionally , we show that the Lie algebra basis can be learned during training , or through a separate optimization process . Hence , our architecture , which generalizes a group convolutional layer , is potentially capable of learning symmetries in data without imposing inductive biases . Learning symmetries in data was tackled in restricted settings of mostly commutative Lie groups as in Cohen & Welling ( 2014 ) and 2D rotations and translations in Rao & Ruderman ( 1999 ) and Sohl-Dickstein et al . ( 2010 ) or permutations ( Anselmi et al. , 2019 ) . However , the symmetries learned by the architecture are not necessarily familiar spatial symmetries . As we show in the case of linear regression , the symmetries may correspond to transformations preserving the statistics of the data . Specifically , we show a general relation between the symmetries of linear regression and a deformed orthogonal group preserving the covariance matrix . Such symmetries of the probability distribution and ways to incorporate them into the architecture were also discussed in Bloem-Reddy & Teh ( 2019 ) . The work that is closest in spirit and setup to ours is Zhou et al . ( 2020 ) which uses meta-learning to automatically learn symmetries . Although the weight-sharing scheme of Zhou et al . ( 2020 ) and their encoding of the symmetry generators is different , their construction does bear some resemblance to ours and we will discuss this after introducing our architecture . Contributions Our main contributions can be summarized as follows • We propose a group equivariant architecture using the Lie algebra , introducing the Lie algebra convolutional layer ( L-conv ) . • In L-conv the Lie algebra generators can be trained to discover symmetries , and it outper- forms CNN on domains with hidden symmetries , such rotated and scrambled images . • Group convolutional layers on connected Lie groups can be approximated by multi-layer L-conv , and Fully-connected , CNN and graph convolutional networks are special cases of L-conv . • In linear regression , we show analytical relations between symmetries in and orthogonal groups preserving covariance of data . 1 EQUIVARIANCE IN SUPERVISED LEARNING . Consider the functional mapping yi = f ( xi ) of inputs X = ( x1 , . . . , xn ) to outputs Y = ( y1 , . . . , yn ) . We assume each input x ∈ Rd×m where Rd are the “ space ” dimensions and Rm the “ channels ” , and y ∈ Rc ( or Zc2 for categorical variables ) . We assume a group G acts only on the space factor ( Rd , shared among channels ) of x through a d-dimensional representation Td : G→ GLd ( R ) mapping each g to an invertible d× d matrix . The map Td must be continuous and satisfy Td ( u ) Td ( v ) = Td ( uv ) for all u , v ∈ G ( Knapp , 2013 , IV.1 ) . Similarly , let G act on y via a c-dimensional representation Tc . To simplify notation , we will denote the representations simply as uα ≡ Tα ( u ) . A function f solving yi = f ( xi ) is said to be equivariant under the action of a group G by representations Tc , Td if ucy = ucf ( x ) = f ( udx ) ∀u ∈ G ⇔ f ( x ) = ucf ( u−1d x ) . ( 1 ) Lie Groups and Lie Algebras The full group of invertible d × d matrices over R is the general linear group , denoted as GLd ( R ) . It follows that every real d- dimensional group representation Td ( G ) ⊂ GLd ( R ) . If T is a “ faithful representation ” ( i.e . T ( u ) 6= T ( v ) if u 6= v ) , thenG ⊂ GLd ( R ) . In our problem , we only know the group G through its linear action on X or on output hl of layer l in a neural network . Therefore we may assume the representation Tdl acting on h l with largest dl is faithful . GLd ( R ) is a Lie group and all of its continuous subgroups G are also Lie groups . Next , we will first briefly review the Lie algebra of a Lie group and then use it to introduce our equivariant architecture . Notation Unless stated or obvious , a in Aa is an index , not an exponent . We write matrix products as A · B ≡ ∑ aA aBa Recall that x ∈ Rd×m . For a linear transformation A : Rd1 → Rd2 acting on the spatial index or the channel index , we will use one upper and one lower index as in Aµνhµ = [ A · h ] ν . We will use ( a , b , c ) for channels , and ( µ , ν , ρ ) for spatial , and ( i , j , k ) for Lie algebra basis indices . We will occasionally keep explicit summation ∑ i for clarity . For any Lie group G ⊂ GLd ( R ) , group elements infinitesimally close to the identity element can be written as u = I + iLi . We can find a basis Li which span the “ Lie algebra ” g of the group G , meaning they are closed under commutations [ Li , Lj ] = LiLj − LjLi = ∑ k fij kLk ( 2 ) with fijk called the structure constants of the Lie algebra . The Li are called the infinitesimal generators of the Lie group . They define vector fields spanning the tangent space of the manifold of G near its identity element I . For elements u ∈ GI in the connected component GI ⊂ G containing the identity , an exponential map exp : g→ GI can be defined such that u = exp [ t · L ] . For matrix groups , if G is connected and compact , the matrix exponential defined through a Taylor expansion is such a map and it is surjective . For most other groups ( except GLd ( C ) and nilpotent groups ) it is not surjective . Nevertheless , for any connected group ( including GI ) every element u can be written as a product u = ∏ α exp [ tα · L ] using the matrix exponential ( Hall , 2015 ) . We will use this fact to modify existing results about group equivariant architectures to introduce L-conv . 2 GROUP EQUIVARIANT ARCHITECTURE . Consider the case where the solution f to y = f ( x ) is implemented as a feedforward neural network . Denote the linear output of layer l by hl = Fl ( hl−1 ) ∈ Rdl×ml , with h0 = xi . Kondor & Trivedi ( 2018 ) ; Cohen & Welling ( 2016a ) showed that a feedforward neural network is equivariant under the action of a group G if and only if each of its layers implement a group convolution ( G-conv ) given by hl = ( fl ∗ gl ) ( hl−1 ) = ∫ G dµ ( u ) fl ( u −1 l−1hl−1 ) gl ( u ) ( 3 ) where dµ ( u ) is the Haar measure on the group manifold , ul is an appropriate dl-dimensional representation of G , and gl : G → Rml×ml+1 is a set of convolution kernels , where ml and ml+1 are the number of input and output channels ( filters ) . Here fl are point-wise activation functions . In the formalism of Kondor & Trivedi ( 2018 ) , we may consider hl to be a map from the homogeneous space Xl to Rml where Xl is a space such that the space of maps LR [ Xl ] is parameterized by Rdl . To use equation 3 in practice , we need to make the integral over the group manifold tractable . Although , Finzi et al . ( 2020 ) , which approximates the integral overG by sampling , approach the idea of working in the Lie algebra , they use a logarithm map to define the Lie algebra . We take a different approach and formulate the architecture in terms of the Lie algebra basis . We also allow the architecture to learn basis Li for the symmetries . For continuous symmetry groups we will now show that using the Lie algebra can approximate G-conv without having to integrate over the full group manifold , thus alleviating the need to discretize or sample the group . The key point is the discreteness and finiteness of the Lie algebra basis for many Lie groups . Proposition 1 . Let G be a Lie group and Td : G → Rdl a dl-dimensional representation of G. If a convolution kernel gl : G → Rml−1×ml has support only on an infinitesimal η neighborhood of identity , a G-conv layer of equation 3 can be written in terms of the Lie algebra . Proof : Linearization over η yields ul ≈ I+ ·L in equation 3 , with Li ∈ Rdl×dl . The inverse is then u−1l ≈ I − · L+O ( 2 ) . Since gl has support only in an η neighborhood of identity , fixing a basis Li , we can reparametrize gl ( I + ·L ) = g̃l ( ) as a function over the Lie algebra g̃l : g→ Rml×ml+1 . Dropping the layer index l for brevity , we have ( f ∗ g ) ( h ) ≈ ∫ G g̃ ( ) f ( ( I − · L ) h ) dnL ≈ ( W 0I −W · L ) h · ∇hf ( h ) ( 4 ) W 0 ≡ ∫ G g̃ ( ) dnL , W i ≡ ∫ G ig̃ ( ) dnL . ( 5 ) where the number of W i is nL , the number of Li . When f ( h ) is a homogeneous function like ReLU or linear activation , h · ∇hf ( h ) = af ( h ) . In general , since we are designing the layers , we can choose h · ∇hf ( h ) = σ ( h ) to be a desired activation function . Note that in G-conv , the convolutional kernels g ( u ) are the trainable weights . The difficulty with learning them is that one has to parametrize and integrate the convolution over the group G. The major advantage of working in the Lie algebra instead of G is that in equation 4 the integrals of g ( ) separate from f ( h ) , leaving us with a set of integrated weights W . This means that instead of the architecture needing to implement the integral ∫ G g ( u ) f ( uh ) dµ , we only need to learn a finite number of convolutional weights W , like the filter weights in CNN . Additionally , we can learn Li . Indeed , having learnable Li to learn hidden symmetries is one of main features we are proposing , as we show in our experiments . L-conv Layer The construction in equation 4 is at the core of our results . h ∈ Rdl−1×ml−1 has components haµ , where µ ∈ { 1 , · · · , dl−1 } is the spatial index and a ∈ { 1 , · · ·ml−1 } the channel index . We define the Lie algebra convolutional layer ( L-conv ) as L-conv : FL ( h ) = σ ( nL∑ i=0 Li · h ·W i + b ) FL ( h ) a µ = σ ∑ ν , c , i [ Li ] ν µ h c ν [ W i ] a c + ba ( 6 ) where σ is the activation function , L0 = I and W i ∈ Rml×ml−1 are the convolutional weights , and the second line shows the components ( all symbols are indices , not exponents ) . Note that , similar to discussion in Weiler et al . ( 2018a ) , an arbitrary nonlinear activation σ may not keep the architecture equivariant under G , but linear activation remains equivariant . Also , note that in equation 3 , fl is the activation σl−1 of the previous layer . In defining L-conv we are including the activation σ after the convolution , which is why σ appears outside in equation 6 instead of as σ ( h ) . Since in connected Lie groups larger group elements can be constructed as u = ∏ α exp [ tα ·L ] ( Hall , 2015 ) from elements near identity , it follows that any G-conv layer can be constructed from multiple L-conv layers on these groups . Proposition 2 . Any G-conv layer on a connected Lie group can be approximated by a multi-layer L-conv to arbitrary accuracy . Proof : To show this we need to take two steps . First , we discretize the support of g ( u ) in equation 3 to infinitesimally small sets G = ⋃ kGk , each having support around an element uk ∈ Gk . This allows us to write ( f ∗ g ) ( h ) ≈ ∑ k ∆µkg ( uk ) f ( u −1 k h ) , where ∆µk = ∫ Gk dµ . Next , we write each uk as a product . On connected groups for any uk ∈ G , we can write uk = ∏l α=1 vα where vα = exp [ tα · L ] ≈ ( I + tα · L ) are elements close to identity . Then , f ( uh ) can be written as a composition l G-conv layers , each with weights gα ( u ) = δ ( u − vα ) ( defined using a faithful representation of G ) f ( u−1k h ) = f ( ∏ α vαh ) = f ( Fl ◦ · · · ◦ F1 ( h ) ) , Fα ( h ) = ∫ G dµ ( u ) fα ( uαh ) gα ( u ) ( 7 ) Since uα are near identity , each Fα can be converted to an L-conv layer with linear activation and weights W = tα and W 0 = 1 . Thus , the G-conv layer can be approximated as sum and composition of L-conv layers . Each Gk can be considered one output channel for the multi-layer L-conv and g ( uk ) are weights of a final aggregation layer . So far we have shown that L-conv layers could replace G-conv for connected groups . The advantage of using L-conv layers is that for many potential symmetry groups , such as orthogonal and unitary groups , the number of generators Li is finite and often a small number of them may be sufficient . For instance , consider SO ( 2 ) rotations on p× p images . The flattened image has d = p2 dimensions and the number of GLd ( R ) generators is p4 . However the induced representation of SO ( 2 ) on Rd has a single generator . In fact , in many domains we expect symmetries hidden in the data to be much lower in dimensionality than the data itself . Additionally , in the other extreme , where there is no restriction on the symmetry , meaning G = GLd ( R ) , we observe that L-conv becomes a fully-connected layer , as shown next . Proposition 3 . A fully-connected neural network layer can be written as an L-conv layer using GLd ( R ) generators , followed by a sum pooling and nonlinear activation . Proof : The generators of GLd ( R ) are one-hot E ∈ Rd×d matrices Li = E ( α , β ) which are non-zero only at index i = ( α , β ) 1 with elements written using Kronecker deltas GLd ( R ) generators : Lνi , µ = [ E ( α , β ) ] νµ = δµαδνβ ( 8 ) Now , consider the weight matrix w ∈ Rm×d and bias b ∈ Rm of a fully connected layer acting on h ∈ Rd as F ( h ) = σ ( w · h+ b ) . The matrix element can be written as wνb = ∑ µ ∑ α , β wαb 1β [ E ( α , β ) ] ν µ = ∑ µ ∑ α , β W b,1 ( α , β ) [ E ( α , β ) ] ν µ = ∑ µ W b,1 · [ L ] νµ ( 9 ) meaning an L-conv layer with weights W b,1 ( α , β ) = w α b 1β ( 1 input channel , and 1 being a vector of ones ) followed by pooling over µ is the same as a fully connected layer with weights w. Thus , interestingly , more restricted groups , rather than large , meaning groups with fewer Li , lead to more parameter sharing . Indeed , as we show below , the most restricted L-conv are graph convolutional networks . It is also easy to see that familiar CNN can be encoded as L-conv . Note that , generally shift operators used in CNN are thought of as group elements for a discrete permutation group . However , the same shift operators Li can be used to create continuous fractional shifts as ( I + αLi ) / ( α+ 1 ) . Since shifts commute with each other , they form a basis for the Lie algebra of an Abelian subgroup of GLd ( R ) . Proposition 4 . CNN is a special case of L-conv where the generators are shift operators . Proof : In 1D CNN , for a kernel size k we have k shift operators Li given by Liνµ = δµ , ν−i . Plugging this into equation 6 and doing the sum over ν , we recover the convolution formula F ( h ) aµ = σ ∑ i , c hcµ−iW i , a c + b a ( 10 ) In higher dimensional CNN , i covers the relevant flattened indices for the required shifts . For instance , a p× q image , when flattened becomes a vector of length pq . To cover a ( 2 , 2 ) convolutional kernel , we need shifts to be by 0 , 1 , q , q + 1 pixels . Thus , we need four Li given by Li ν µ = δµ , ν−si , si = [ 0 , 1 , q , q + 1 ] i ( 11 ) This means that the number of generators Li is the size of the convolutional kernel in CNN . Generalization to higher dimensions is straightforward . In CNN , covering larger patches is equivalent to g ( u ) covering a larger part of the group . But large convolutional kernels are not generally used . Instead , we achieve larger receptive fields by adding more CNN layers , similar to Proposition 2 . 1We may also label them by single index like i = α+ βd , but two indices is more convenient . Connection with Graph Convolutional Networks Finally , we note that the L-conv layer equation 6 has the structure of a Graph Convolutional Networks ( GCN ) Kipf & Welling ( 2016 ) with multiple propagation rules Li derived from graph adjacency matrices and µ , ν indexing graph vertices . Thus , an L-conv with a single L is a GCN . In fact , there is a deeper connection here , as we show now . Proposition 5 . A GCN with propagation rule A ∈ Rd×d is equivalent to an L-conv , with the group being 1D flows generated by A− I . Proof : We can define a linear flow similar to a diffusion equation h ( t+ δt ) = Ahν ( t ) ⇒ dh ( t ) dt = λ ( A− I ) h ( t ) ( 12 ) where λ = δt/dt sets the time scale . Thus L = λ ( A− I ) is the generator a 1D group of flows with elements u = exp [ tL ] , a subgroup of the group of diffeomorphisms on Rd , with a single generator L. Thus , a GCN with propagation rule A is an L-conv using L0 = I and L1 = L with the same convolutional weights for L0 , L1 . Hence , the most restricted L-conv based on 1D flow groups with a single generator are GCN . These flow groups include Hamiltonian flows and other linear dynamical systems . CNN can also be interpreted as a GCN with multiple propagation rules , where each shift operator is a subgraph of the grid network .
The paper presents a new approach for building group-equivariant neural networks. The authors propose *L-conv*, a layer which is equivariant to transformations from a group $G$ in the neighborhood of identity. They show that a network with a sufficient number of such layers is $G$-equivariant as a whole. Additionally, the authors propose to learn the structure of the group directly from the training data instead of incorporating it in the network *a priori*.
SP:c157b650393ac987f2816812d1b720e41a8eb39c
Lie Algebra Convolutional Neural Networks with Automatic Symmetry Extraction
Many machine learning ( ML ) tasks involve data from unfamiliar domains , which may or may not have hidden symmetries . While much of the work on equivariant neural networks focuses on equivariant architectures , the ability of the architecture to discover symmetries in a given dataset is less studied . Convolutional Neural Networks ( CNN ) ( LeCun et al. , 1989 ; 1998 ) incorporate translation symmetry into the architecture . Recently , more general ways to construct equivariant architectures have been introduced ( Cohen & Welling , 2016a ; b ; Cohen et al. , 2018 ; Kondor & Trivedi , 2018 ) . Encoding equivariance into an ML architecture can reduce data requirements and improve generalization , while significantly reducing the number of model parameters via parameter sharing ( Cohen et al. , 2019 ; Cohen & Welling , 2016b ; Ravanbakhsh et al. , 2017 ; Ravanbakhsh , 2020 ) . As a result , many other symmetries such as discrete rotations in 2D ( Veeling et al. , 2018 ; Marcos et al. , 2017 ) and 3D ( Cohen et al. , 2018 ; Cohen & Welling , 2016a ) as well as permutations ( Zaheer et al. , 2017 ) have been incorporated into the architecture of neural networks . Many existing works on equivariant architectures use finite groups such as permutations in Hartford et al . ( 2018 ) and Ravanbakhsh et al . ( 2017 ) or discrete subgroups of continuous groups , such as 90 degree rotations in ( Cohen et al. , 2018 ) or dihedral groups DN in Weiler & Cesa ( 2019 ) . Ravanbakhsh ( 2020 ) also proved a universal approximation theorem for single hidden layer equivariant neural networks for Abelian and finite groups . General principles for constructing group convolutional layers were introduced in Cohen & Welling ( 2016b ) , Kondor & Trivedi ( 2018 ) , and Cohen et al . ( 2019 ) , including for continuous groups . A challenge for implementation is having to integrate over the group manifold . This has been remedied either by generalizing Fast Fourier Transforms ( Cohen et al. , 2018 ) , or using irreducible representations ( irreps ) ( Weiler et al. , 2018a ) either directly as spherical harmonics as in Worrall et al . ( 2017 ) or using more general Clebsch-Gordon coefficients ( Kondor et al. , 2018 ) . Other approaches include discretizing the group as in Weiler et al . ( 2018a ; b ) ; Cohen & Welling ( 2016a ) , or solving constraints for equivariant irreps as in Weiler & Cesa ( 2019 ) , or approximating the integral by sampling ( Finzi et al. , 2020 ) . The limitations in all of the approaches above are that : 1 ) they rely on knowing the symmetry group a priori , and 2 ) require encoding the whole group into the architecture . For a continuous group , it is not possible to encode all elements and we have to resort to discretization or a truncated sum over irreps . Our work attempts to resolve the issues with continuous groups by using the Lie algebra ( the linearization of the group near its identity ) instead of the group itself . Unlike the Lie group which is infinite , the Lie algebra usually has a finite basis ( notable exception being Kac-Moody Lie algebras for 2D Conformal Field Theories ( Belavin et al. , 1984 ) in physics ) . Additionally , we show that the Lie algebra basis can be learned during training , or through a separate optimization process . Hence , our architecture , which generalizes a group convolutional layer , is potentially capable of learning symmetries in data without imposing inductive biases . Learning symmetries in data was tackled in restricted settings of mostly commutative Lie groups as in Cohen & Welling ( 2014 ) and 2D rotations and translations in Rao & Ruderman ( 1999 ) and Sohl-Dickstein et al . ( 2010 ) or permutations ( Anselmi et al. , 2019 ) . However , the symmetries learned by the architecture are not necessarily familiar spatial symmetries . As we show in the case of linear regression , the symmetries may correspond to transformations preserving the statistics of the data . Specifically , we show a general relation between the symmetries of linear regression and a deformed orthogonal group preserving the covariance matrix . Such symmetries of the probability distribution and ways to incorporate them into the architecture were also discussed in Bloem-Reddy & Teh ( 2019 ) . The work that is closest in spirit and setup to ours is Zhou et al . ( 2020 ) which uses meta-learning to automatically learn symmetries . Although the weight-sharing scheme of Zhou et al . ( 2020 ) and their encoding of the symmetry generators is different , their construction does bear some resemblance to ours and we will discuss this after introducing our architecture . Contributions Our main contributions can be summarized as follows • We propose a group equivariant architecture using the Lie algebra , introducing the Lie algebra convolutional layer ( L-conv ) . • In L-conv the Lie algebra generators can be trained to discover symmetries , and it outper- forms CNN on domains with hidden symmetries , such rotated and scrambled images . • Group convolutional layers on connected Lie groups can be approximated by multi-layer L-conv , and Fully-connected , CNN and graph convolutional networks are special cases of L-conv . • In linear regression , we show analytical relations between symmetries in and orthogonal groups preserving covariance of data . 1 EQUIVARIANCE IN SUPERVISED LEARNING . Consider the functional mapping yi = f ( xi ) of inputs X = ( x1 , . . . , xn ) to outputs Y = ( y1 , . . . , yn ) . We assume each input x ∈ Rd×m where Rd are the “ space ” dimensions and Rm the “ channels ” , and y ∈ Rc ( or Zc2 for categorical variables ) . We assume a group G acts only on the space factor ( Rd , shared among channels ) of x through a d-dimensional representation Td : G→ GLd ( R ) mapping each g to an invertible d× d matrix . The map Td must be continuous and satisfy Td ( u ) Td ( v ) = Td ( uv ) for all u , v ∈ G ( Knapp , 2013 , IV.1 ) . Similarly , let G act on y via a c-dimensional representation Tc . To simplify notation , we will denote the representations simply as uα ≡ Tα ( u ) . A function f solving yi = f ( xi ) is said to be equivariant under the action of a group G by representations Tc , Td if ucy = ucf ( x ) = f ( udx ) ∀u ∈ G ⇔ f ( x ) = ucf ( u−1d x ) . ( 1 ) Lie Groups and Lie Algebras The full group of invertible d × d matrices over R is the general linear group , denoted as GLd ( R ) . It follows that every real d- dimensional group representation Td ( G ) ⊂ GLd ( R ) . If T is a “ faithful representation ” ( i.e . T ( u ) 6= T ( v ) if u 6= v ) , thenG ⊂ GLd ( R ) . In our problem , we only know the group G through its linear action on X or on output hl of layer l in a neural network . Therefore we may assume the representation Tdl acting on h l with largest dl is faithful . GLd ( R ) is a Lie group and all of its continuous subgroups G are also Lie groups . Next , we will first briefly review the Lie algebra of a Lie group and then use it to introduce our equivariant architecture . Notation Unless stated or obvious , a in Aa is an index , not an exponent . We write matrix products as A · B ≡ ∑ aA aBa Recall that x ∈ Rd×m . For a linear transformation A : Rd1 → Rd2 acting on the spatial index or the channel index , we will use one upper and one lower index as in Aµνhµ = [ A · h ] ν . We will use ( a , b , c ) for channels , and ( µ , ν , ρ ) for spatial , and ( i , j , k ) for Lie algebra basis indices . We will occasionally keep explicit summation ∑ i for clarity . For any Lie group G ⊂ GLd ( R ) , group elements infinitesimally close to the identity element can be written as u = I + iLi . We can find a basis Li which span the “ Lie algebra ” g of the group G , meaning they are closed under commutations [ Li , Lj ] = LiLj − LjLi = ∑ k fij kLk ( 2 ) with fijk called the structure constants of the Lie algebra . The Li are called the infinitesimal generators of the Lie group . They define vector fields spanning the tangent space of the manifold of G near its identity element I . For elements u ∈ GI in the connected component GI ⊂ G containing the identity , an exponential map exp : g→ GI can be defined such that u = exp [ t · L ] . For matrix groups , if G is connected and compact , the matrix exponential defined through a Taylor expansion is such a map and it is surjective . For most other groups ( except GLd ( C ) and nilpotent groups ) it is not surjective . Nevertheless , for any connected group ( including GI ) every element u can be written as a product u = ∏ α exp [ tα · L ] using the matrix exponential ( Hall , 2015 ) . We will use this fact to modify existing results about group equivariant architectures to introduce L-conv . 2 GROUP EQUIVARIANT ARCHITECTURE . Consider the case where the solution f to y = f ( x ) is implemented as a feedforward neural network . Denote the linear output of layer l by hl = Fl ( hl−1 ) ∈ Rdl×ml , with h0 = xi . Kondor & Trivedi ( 2018 ) ; Cohen & Welling ( 2016a ) showed that a feedforward neural network is equivariant under the action of a group G if and only if each of its layers implement a group convolution ( G-conv ) given by hl = ( fl ∗ gl ) ( hl−1 ) = ∫ G dµ ( u ) fl ( u −1 l−1hl−1 ) gl ( u ) ( 3 ) where dµ ( u ) is the Haar measure on the group manifold , ul is an appropriate dl-dimensional representation of G , and gl : G → Rml×ml+1 is a set of convolution kernels , where ml and ml+1 are the number of input and output channels ( filters ) . Here fl are point-wise activation functions . In the formalism of Kondor & Trivedi ( 2018 ) , we may consider hl to be a map from the homogeneous space Xl to Rml where Xl is a space such that the space of maps LR [ Xl ] is parameterized by Rdl . To use equation 3 in practice , we need to make the integral over the group manifold tractable . Although , Finzi et al . ( 2020 ) , which approximates the integral overG by sampling , approach the idea of working in the Lie algebra , they use a logarithm map to define the Lie algebra . We take a different approach and formulate the architecture in terms of the Lie algebra basis . We also allow the architecture to learn basis Li for the symmetries . For continuous symmetry groups we will now show that using the Lie algebra can approximate G-conv without having to integrate over the full group manifold , thus alleviating the need to discretize or sample the group . The key point is the discreteness and finiteness of the Lie algebra basis for many Lie groups . Proposition 1 . Let G be a Lie group and Td : G → Rdl a dl-dimensional representation of G. If a convolution kernel gl : G → Rml−1×ml has support only on an infinitesimal η neighborhood of identity , a G-conv layer of equation 3 can be written in terms of the Lie algebra . Proof : Linearization over η yields ul ≈ I+ ·L in equation 3 , with Li ∈ Rdl×dl . The inverse is then u−1l ≈ I − · L+O ( 2 ) . Since gl has support only in an η neighborhood of identity , fixing a basis Li , we can reparametrize gl ( I + ·L ) = g̃l ( ) as a function over the Lie algebra g̃l : g→ Rml×ml+1 . Dropping the layer index l for brevity , we have ( f ∗ g ) ( h ) ≈ ∫ G g̃ ( ) f ( ( I − · L ) h ) dnL ≈ ( W 0I −W · L ) h · ∇hf ( h ) ( 4 ) W 0 ≡ ∫ G g̃ ( ) dnL , W i ≡ ∫ G ig̃ ( ) dnL . ( 5 ) where the number of W i is nL , the number of Li . When f ( h ) is a homogeneous function like ReLU or linear activation , h · ∇hf ( h ) = af ( h ) . In general , since we are designing the layers , we can choose h · ∇hf ( h ) = σ ( h ) to be a desired activation function . Note that in G-conv , the convolutional kernels g ( u ) are the trainable weights . The difficulty with learning them is that one has to parametrize and integrate the convolution over the group G. The major advantage of working in the Lie algebra instead of G is that in equation 4 the integrals of g ( ) separate from f ( h ) , leaving us with a set of integrated weights W . This means that instead of the architecture needing to implement the integral ∫ G g ( u ) f ( uh ) dµ , we only need to learn a finite number of convolutional weights W , like the filter weights in CNN . Additionally , we can learn Li . Indeed , having learnable Li to learn hidden symmetries is one of main features we are proposing , as we show in our experiments . L-conv Layer The construction in equation 4 is at the core of our results . h ∈ Rdl−1×ml−1 has components haµ , where µ ∈ { 1 , · · · , dl−1 } is the spatial index and a ∈ { 1 , · · ·ml−1 } the channel index . We define the Lie algebra convolutional layer ( L-conv ) as L-conv : FL ( h ) = σ ( nL∑ i=0 Li · h ·W i + b ) FL ( h ) a µ = σ ∑ ν , c , i [ Li ] ν µ h c ν [ W i ] a c + ba ( 6 ) where σ is the activation function , L0 = I and W i ∈ Rml×ml−1 are the convolutional weights , and the second line shows the components ( all symbols are indices , not exponents ) . Note that , similar to discussion in Weiler et al . ( 2018a ) , an arbitrary nonlinear activation σ may not keep the architecture equivariant under G , but linear activation remains equivariant . Also , note that in equation 3 , fl is the activation σl−1 of the previous layer . In defining L-conv we are including the activation σ after the convolution , which is why σ appears outside in equation 6 instead of as σ ( h ) . Since in connected Lie groups larger group elements can be constructed as u = ∏ α exp [ tα ·L ] ( Hall , 2015 ) from elements near identity , it follows that any G-conv layer can be constructed from multiple L-conv layers on these groups . Proposition 2 . Any G-conv layer on a connected Lie group can be approximated by a multi-layer L-conv to arbitrary accuracy . Proof : To show this we need to take two steps . First , we discretize the support of g ( u ) in equation 3 to infinitesimally small sets G = ⋃ kGk , each having support around an element uk ∈ Gk . This allows us to write ( f ∗ g ) ( h ) ≈ ∑ k ∆µkg ( uk ) f ( u −1 k h ) , where ∆µk = ∫ Gk dµ . Next , we write each uk as a product . On connected groups for any uk ∈ G , we can write uk = ∏l α=1 vα where vα = exp [ tα · L ] ≈ ( I + tα · L ) are elements close to identity . Then , f ( uh ) can be written as a composition l G-conv layers , each with weights gα ( u ) = δ ( u − vα ) ( defined using a faithful representation of G ) f ( u−1k h ) = f ( ∏ α vαh ) = f ( Fl ◦ · · · ◦ F1 ( h ) ) , Fα ( h ) = ∫ G dµ ( u ) fα ( uαh ) gα ( u ) ( 7 ) Since uα are near identity , each Fα can be converted to an L-conv layer with linear activation and weights W = tα and W 0 = 1 . Thus , the G-conv layer can be approximated as sum and composition of L-conv layers . Each Gk can be considered one output channel for the multi-layer L-conv and g ( uk ) are weights of a final aggregation layer . So far we have shown that L-conv layers could replace G-conv for connected groups . The advantage of using L-conv layers is that for many potential symmetry groups , such as orthogonal and unitary groups , the number of generators Li is finite and often a small number of them may be sufficient . For instance , consider SO ( 2 ) rotations on p× p images . The flattened image has d = p2 dimensions and the number of GLd ( R ) generators is p4 . However the induced representation of SO ( 2 ) on Rd has a single generator . In fact , in many domains we expect symmetries hidden in the data to be much lower in dimensionality than the data itself . Additionally , in the other extreme , where there is no restriction on the symmetry , meaning G = GLd ( R ) , we observe that L-conv becomes a fully-connected layer , as shown next . Proposition 3 . A fully-connected neural network layer can be written as an L-conv layer using GLd ( R ) generators , followed by a sum pooling and nonlinear activation . Proof : The generators of GLd ( R ) are one-hot E ∈ Rd×d matrices Li = E ( α , β ) which are non-zero only at index i = ( α , β ) 1 with elements written using Kronecker deltas GLd ( R ) generators : Lνi , µ = [ E ( α , β ) ] νµ = δµαδνβ ( 8 ) Now , consider the weight matrix w ∈ Rm×d and bias b ∈ Rm of a fully connected layer acting on h ∈ Rd as F ( h ) = σ ( w · h+ b ) . The matrix element can be written as wνb = ∑ µ ∑ α , β wαb 1β [ E ( α , β ) ] ν µ = ∑ µ ∑ α , β W b,1 ( α , β ) [ E ( α , β ) ] ν µ = ∑ µ W b,1 · [ L ] νµ ( 9 ) meaning an L-conv layer with weights W b,1 ( α , β ) = w α b 1β ( 1 input channel , and 1 being a vector of ones ) followed by pooling over µ is the same as a fully connected layer with weights w. Thus , interestingly , more restricted groups , rather than large , meaning groups with fewer Li , lead to more parameter sharing . Indeed , as we show below , the most restricted L-conv are graph convolutional networks . It is also easy to see that familiar CNN can be encoded as L-conv . Note that , generally shift operators used in CNN are thought of as group elements for a discrete permutation group . However , the same shift operators Li can be used to create continuous fractional shifts as ( I + αLi ) / ( α+ 1 ) . Since shifts commute with each other , they form a basis for the Lie algebra of an Abelian subgroup of GLd ( R ) . Proposition 4 . CNN is a special case of L-conv where the generators are shift operators . Proof : In 1D CNN , for a kernel size k we have k shift operators Li given by Liνµ = δµ , ν−i . Plugging this into equation 6 and doing the sum over ν , we recover the convolution formula F ( h ) aµ = σ ∑ i , c hcµ−iW i , a c + b a ( 10 ) In higher dimensional CNN , i covers the relevant flattened indices for the required shifts . For instance , a p× q image , when flattened becomes a vector of length pq . To cover a ( 2 , 2 ) convolutional kernel , we need shifts to be by 0 , 1 , q , q + 1 pixels . Thus , we need four Li given by Li ν µ = δµ , ν−si , si = [ 0 , 1 , q , q + 1 ] i ( 11 ) This means that the number of generators Li is the size of the convolutional kernel in CNN . Generalization to higher dimensions is straightforward . In CNN , covering larger patches is equivalent to g ( u ) covering a larger part of the group . But large convolutional kernels are not generally used . Instead , we achieve larger receptive fields by adding more CNN layers , similar to Proposition 2 . 1We may also label them by single index like i = α+ βd , but two indices is more convenient . Connection with Graph Convolutional Networks Finally , we note that the L-conv layer equation 6 has the structure of a Graph Convolutional Networks ( GCN ) Kipf & Welling ( 2016 ) with multiple propagation rules Li derived from graph adjacency matrices and µ , ν indexing graph vertices . Thus , an L-conv with a single L is a GCN . In fact , there is a deeper connection here , as we show now . Proposition 5 . A GCN with propagation rule A ∈ Rd×d is equivalent to an L-conv , with the group being 1D flows generated by A− I . Proof : We can define a linear flow similar to a diffusion equation h ( t+ δt ) = Ahν ( t ) ⇒ dh ( t ) dt = λ ( A− I ) h ( t ) ( 12 ) where λ = δt/dt sets the time scale . Thus L = λ ( A− I ) is the generator a 1D group of flows with elements u = exp [ tL ] , a subgroup of the group of diffeomorphisms on Rd , with a single generator L. Thus , a GCN with propagation rule A is an L-conv using L0 = I and L1 = L with the same convolutional weights for L0 , L1 . Hence , the most restricted L-conv based on 1D flow groups with a single generator are GCN . These flow groups include Hamiltonian flows and other linear dynamical systems . CNN can also be interpreted as a GCN with multiple propagation rules , where each shift operator is a subgraph of the grid network .
The paper meticulously builds a theoretical framework for Lie-algebra convolutional layers and then goes on to show how CNNs, GCNs and FC layers are a special case of L-convs. The paper also demonstrates how the underlying generators can be learnt from data and provide convincing supporting experimental results. The proposed L-conv layers also use much fewer parameters compared to previous works.
SP:c157b650393ac987f2816812d1b720e41a8eb39c
Temperature check: theory and practice for training models with softmax-cross-entropy losses
1 INTRODUCTION . Deep learning has led to breakthroughs across a slew of classification tasks ( LeCun et al. , 1989 ; Krizhevsky et al. , 2012 ; Zagoruyko and Komodakis , 2017 ) . Crucial components of this success have been the use of the softmax function to model predicted class-probabilities combined with the cross-entropy loss function as a measure of distance between the predicted distribution and the label ( Kline and Berardi , 2005 ; Golik et al. , 2013 ) . Significant work has gone into improving the generalization performance of softmax-cross-entropy learning . A particularly successful approach has been to improve overfitting by reducing model confidence ; this has been done by regularizing outputs using confidence regularization ( Pereyra et al. , 2017 ) or by augmenting data using label smoothing ( Müller et al. , 2019 ; Szegedy et al. , 2016 ) . Another way to manipulate model confidence is to tune the temperature of the softmax function , which is otherwise commonly set to one . Adjusting the softmax temperature during training has been shown to be important in metric learning ( Wu et al. , 2018 ; Zhai and Wu , 2019 ) and when performing distillation ( Hinton et al. , 2015 ) ; as well as for post-training calibration of prediction probabilities ( Platt , 2000 ; Guo et al. , 2017 ) . The interplay between temperature , learning , and generalization is complex and not well-understood in the general case . Although significant recent theoretical progress has been made understanding generalization and learning in wide neural networks approximated as linear models , analysis of linearized learning dynamics has largely focused on the case of squared error losses ( Jacot et al. , 2018 ; Du et al. , 2019 ; Lee et al. , 2019 ; Novak et al. , 2019a ; Xiao et al. , 2019 ) . Infinitely-wide networks trained with softmax-cross-entropy loss have been shown to converge to max-margin classifiers in a particular function space norm ( Chizat and Bach , 2020 ) , but timescales of convergence are not known . Additionally , many well-performing models operate best away from the linearized regime ( Novak et al. , 2019a ; Aitchison , 2019 ) . This means that understanding the deviations of models from their linearization around initialization is important for understanding generalization ( Lee et al. , 2019 ; Chizat et al. , 2019 ) . In this paper , we investigate the training of neural networks with softmax-cross-entropy losses . In general this problem is analytically intractable ; to make progress we pursue a strategy that combines analytic insights at short times with a comprehensive set of experiments that capture the entirety of training . At short times , models can be understood in terms of a linearization about their initial parameters along with nonlinear corrections . In the linear regime we find that networks trained with different inverse-temperatures , β = 1/T , behave identically provided the learning rate is scaled as η̃ = ηβ2 . Here , networks begin to learn over a timescale τz ∼ ‖Z0‖2/η̃ where Z0 are the initial logits of the network after being multiplied by β . This implies that we expect learning to begin faster for networks with smaller logits . The learning dynamics begin to become nonlinear over another , independent , timescale τnl ∼ β/η̃ , suggesting more nonlinear learning for small β . From previous results we expect that neural networks will perform best in this regime where they quickly exit the linear regime ( Chizat et al. , 2019 ; Lee et al. , 2020 ; Lewkowycz et al. , 2020 ) . We combine these analytic results with extensive experiments on competitive neural networks across a range of architectures and domains including : Wide Residual networks ( Zagoruyko and Komodakis , 2017 ) on CIFAR10 ( Krizhevsky , 2009 ) , ResNet-50 ( He et al. , 2016 ) on ImageNet ( Deng et al. , 2009 ) , and GRUs ( Chung et al. , 2014 ) on the IMDB sentiment analysis task ( Maas et al. , 2011 ) . In the case of residual networks , we consider architectures with and without batch normalization , which can appreciably change the learning dynamics ( Ioffe and Szegedy , 2015 ) . For all models studied , we find that generalization performance is poor at ‖Z0‖2 1 but otherwise largely independent of ‖Z0‖2 . Moreover , learning becomes slower and less stable at very small β ; indeed , the optimal learning rate scales like η∗ ∼ 1/β and the resulting early learning timescale can be written as τ∗z ∼ ‖Z0‖2/β . For all models studied , we observe strong performance for β ∈ [ 10−2 , 101 ] although the specific optimal β is architecture dependent . Emphatically , the optimal β is often far from 1 . For models without batch normalization , smaller β can give stronger results on some training runs , with others failing to train due to instability . Overall , these results suggest that model performance can often be improved by tuning β over the range of [ 10−2 , 101 ] . 2 THEORY . We begin with a precise description of the problem setting before discussing a theory of learning at short times . We will show the following : • The inverse temperature β and logit scale ‖Z0‖ control timescales which determine the rate of change of the loss , the relative change in logits , and the time for learning to leave the linear learning regime . • Small β causes training to access the non-linear learning regime . We will see empirically that increasing access to the non-linear regime can improve generalization . • The largest allowable learning rate is set by the timescale to leave the linearized learning regime , which suggests that networks with small β will train more slowly . All numerical results in this section are using a Wide Resnet ( Zagoruyko and Komodakis , 2017 ) trained on CIFAR10 . 2.1 BASIC MODEL AND NOTATION . We consider a classification task with K classes . For an N dimensional input x , let z ( x , θ ) be the pre-softmax output of a classification model parameterized by θ ∈ RP , such that the classifier predicts the class i corresponding to the largest output value zi . We will mainly consider θ trained by SGD on a training set ( X , Y ) of M input-label pairs . We focus on models trained with cross-entropy loss with a non-trivial inverse temperature β . The softmax-cross-entropy loss can be written as L ( θ , X , Y ) = K∑ i=1 Yi · ln ( σ ( βzi ( X , θ ) ) ) = K∑ i=1 Yi · ln ( σ ( Zi ( X , θ ) ) ) ( 1 ) where we define the rescaled logits Z = βz and σ ( Z ) i = eZi/ ∑ j e Zj is the softmax function . Here Z ( X , θ ) is the M ×K dimensional matrix of rescaled logits on the training set . As we will see later , the statistics of individual σ ( Z ) i will have a strong influence on the learning dynamics . While the statistics of σ ( Z ) i are intractable for intermediate magnitudes , ‖Z‖2 , they can be understood in the limits of large and small ‖Z‖2 . For a fixed model z ( x , θ ) , β controls the certainty of the predicted probabilities . Values of β such that β 1/‖z‖2 will give small values of ‖Z‖2 1 , and the outputs of the softmax will be close to 1/K independent of i ( the maximum-entropy distribution on K classes ) . Larger values of β such that β 1/‖z‖2 will lead to large values of ‖Z‖2 1 ; the resulting distribution has probability close to 1 on one label , and ( exponentially ) close to 0 on the others . The continuous time learning dynamics ( exact in the limit of small learning rate ) are given by : θ̇ = ηβ K∑ i=1 ( ∂zi ( X , θ ( t ) ) ∂θ ) T ( Yi − σ ( Zi ( X , θ ( t ) ) ) ( 2 ) for learning rate η . We will drop the explicit dependence of Zi on θ from here onward , and we will denote time dependence as Zi ( X , t ) explicitly where needed . In function space , the dynamics of the model outputs on an input x are given by dzi ( x ) dt = ηβ K∑ j=1 ( Θ̂θ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) ( 3 ) where we define the M ×M ×K ×K dimensional tensor Θ̂θ , the empirical neural tangent kernel ( NTK ) , as ( Θ̂θ ) ij ( x , X ′ ) ≡ ∂zi ( x ) ∂θ ( ∂zj ( X ) ∂θ ) T ( 4 ) for class indices i and j , which is block-diagonal in the infinite-width limit . From Equation 3 , we see that the early-time dynamics in function space depend on β , the initial softmax input Z ( X , 0 ) on the training set , and the initial Θ̂θ . Changing these observables across a model family will lead to different learning trajectories early in learning . Since significant work has already studied the effects of the NTK , here we focus on the effects of changing β and ‖Z0‖F ≡ ‖Z ( X , 0 ) ‖F ( the norm of the M ×K dimensional matrix of training logits ) , independent of Θ̂θ . 2.2 LINEARIZED DYNAMICS . For small changes in θ , the tangent kernel is approximately constant throughout learning ( Jacot et al. , 2018 ) , and we drop the explicit θ dependence in this subsection . The linearized dynamics of z ( x , t ) only depend on the initial value of Θ̂ and the β-scaled logit values Z ( X , t ) . This suggests that there is a universal timescale across β and η which can be used to compare linearized trajectories with different parameter values . Indeed , if we define an effective learning rate η̃ ≡ ηβ2 , we have dZi ( x ) dt = η̃ K∑ j=1 ( Θ̂ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) ( 5 ) which removes explicit β dependence of the dynamics . We note that a similar rescaling exists for the continuous time versions of other optimizers like momentum ( Appendix B ) . The effective learning rate η̃ is useful for understanding the nonlinear dynamics , as plotting learning curves versus η̃t causes early-time collapse for fixed Z0 across β and η ( Figure 1 ) . We see that there is a strong , monotonic , dependence of the time at which the nonlinear model begins to deviate from its linearization on β . We will return to and explain this phenomenon in Section 2.4 . Unless otherwise noted , we will analyze all timescales in units of η̃ instead of η , as it will allow for the appropriate early-time comparisons between models with different β . 2.3 EARLY LEARNING TIMESCALE . We now define and compute the early learning timescale , τz , that measures the time it takes for the logits to change significantly from their initial value . Specifically , we define τz such that for t τz we expect ‖Z ( x , t ) −Z ( x , 0 ) ‖F ‖Z ( x , 0 ) ‖F and for t τz , ‖Z ( x , t ) −Z ( x , 0 ) ‖F ∼ ‖Z ( x , 0 ) ‖F ( or larger ) . This is synonymous with the timescale over which the model begins to learn . As we will show below , τz ∝ ‖Z0‖F /η̃ . Therefore in units of η̃ , τz only depends on ‖Z0‖F and not β . To see this , note that at very short times it follows from Equation 5 that Zi ( x , t ) − Zi ( x , 0 ) ≈ η̃ K∑ j=1 ( Θ̂ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) t+O ( t2 ) ( 6 ) It follows that we can define a timescale over which the logits ( on the training set ) change appreciably from their initial value as τz ≡ 1 η̃ ‖Z0‖F ‖Θ̂ ( X , X ) ( Y − σ ( Z0 ) ) ‖F . ( 7 ) where the norms are once again taken across all classes as well as training points . This definition has the desired properties for t τz and t τz . In units of η̃ , τz depends only on ‖Z0‖F , in two ways . The first is a linear scaling in ‖Z0‖F ; the second comes from the contribution from the gradient ‖Θ̂ ( X , X ) ( Y−σ ( Z ( X , 0 ) ) ) ‖F . As previously discussed , since σ ( Z0 ) saturates at small and large values of ‖Z0‖F , it follows that the gradient term will also saturate for large and small ‖Z0‖F , and the ratio of saturating values is some O ( 1 ) constant independent of ‖Z0‖F and β . The quantitative and conceptual nature of τz can both be confirmed numerically . We compute τz explicitly as || [ Zi ( x , t ) − Zi ( x , 0 ) ] /t|| for short times ( Figure 2 , left ) . When plotted over a wide range of ‖Z0‖F and β , the ratio τz/‖Z0‖F ( in rescaled time units ) undergoes a saturating , O ( 1 ) variation from small to large ‖Z0‖F . The quantitative dependence of the transition on the NTK is confirmed in Appendix C. Additionally , for fixed β and varying ‖Z0‖F , rescaling time by 1/τz causes accuracy curves to collapse at early times ( Figure 2 , middle ) , even if they are very different at early times without the rescaling ( right ) . We note here that the late time accuracy curves seem similar across ‖Z0‖F without rescaling , a point which we will return to in Section 3.2 .
This paper studies how temperature scaling affects training dynamics of neural networks (with softmax layer and cross-entropy loss). The theoretical analysis shows that neural networks trained with smaller inverse temperatures (beta) exit the linear regime faster, which implies better performance. Experiments on image classification and sentiment analysis confirm that tuning temperature improves neural network generalization, even for state-of-the-art models.
SP:9002e8827008fb50594757c4aab871b9cb29963b
Temperature check: theory and practice for training models with softmax-cross-entropy losses
1 INTRODUCTION . Deep learning has led to breakthroughs across a slew of classification tasks ( LeCun et al. , 1989 ; Krizhevsky et al. , 2012 ; Zagoruyko and Komodakis , 2017 ) . Crucial components of this success have been the use of the softmax function to model predicted class-probabilities combined with the cross-entropy loss function as a measure of distance between the predicted distribution and the label ( Kline and Berardi , 2005 ; Golik et al. , 2013 ) . Significant work has gone into improving the generalization performance of softmax-cross-entropy learning . A particularly successful approach has been to improve overfitting by reducing model confidence ; this has been done by regularizing outputs using confidence regularization ( Pereyra et al. , 2017 ) or by augmenting data using label smoothing ( Müller et al. , 2019 ; Szegedy et al. , 2016 ) . Another way to manipulate model confidence is to tune the temperature of the softmax function , which is otherwise commonly set to one . Adjusting the softmax temperature during training has been shown to be important in metric learning ( Wu et al. , 2018 ; Zhai and Wu , 2019 ) and when performing distillation ( Hinton et al. , 2015 ) ; as well as for post-training calibration of prediction probabilities ( Platt , 2000 ; Guo et al. , 2017 ) . The interplay between temperature , learning , and generalization is complex and not well-understood in the general case . Although significant recent theoretical progress has been made understanding generalization and learning in wide neural networks approximated as linear models , analysis of linearized learning dynamics has largely focused on the case of squared error losses ( Jacot et al. , 2018 ; Du et al. , 2019 ; Lee et al. , 2019 ; Novak et al. , 2019a ; Xiao et al. , 2019 ) . Infinitely-wide networks trained with softmax-cross-entropy loss have been shown to converge to max-margin classifiers in a particular function space norm ( Chizat and Bach , 2020 ) , but timescales of convergence are not known . Additionally , many well-performing models operate best away from the linearized regime ( Novak et al. , 2019a ; Aitchison , 2019 ) . This means that understanding the deviations of models from their linearization around initialization is important for understanding generalization ( Lee et al. , 2019 ; Chizat et al. , 2019 ) . In this paper , we investigate the training of neural networks with softmax-cross-entropy losses . In general this problem is analytically intractable ; to make progress we pursue a strategy that combines analytic insights at short times with a comprehensive set of experiments that capture the entirety of training . At short times , models can be understood in terms of a linearization about their initial parameters along with nonlinear corrections . In the linear regime we find that networks trained with different inverse-temperatures , β = 1/T , behave identically provided the learning rate is scaled as η̃ = ηβ2 . Here , networks begin to learn over a timescale τz ∼ ‖Z0‖2/η̃ where Z0 are the initial logits of the network after being multiplied by β . This implies that we expect learning to begin faster for networks with smaller logits . The learning dynamics begin to become nonlinear over another , independent , timescale τnl ∼ β/η̃ , suggesting more nonlinear learning for small β . From previous results we expect that neural networks will perform best in this regime where they quickly exit the linear regime ( Chizat et al. , 2019 ; Lee et al. , 2020 ; Lewkowycz et al. , 2020 ) . We combine these analytic results with extensive experiments on competitive neural networks across a range of architectures and domains including : Wide Residual networks ( Zagoruyko and Komodakis , 2017 ) on CIFAR10 ( Krizhevsky , 2009 ) , ResNet-50 ( He et al. , 2016 ) on ImageNet ( Deng et al. , 2009 ) , and GRUs ( Chung et al. , 2014 ) on the IMDB sentiment analysis task ( Maas et al. , 2011 ) . In the case of residual networks , we consider architectures with and without batch normalization , which can appreciably change the learning dynamics ( Ioffe and Szegedy , 2015 ) . For all models studied , we find that generalization performance is poor at ‖Z0‖2 1 but otherwise largely independent of ‖Z0‖2 . Moreover , learning becomes slower and less stable at very small β ; indeed , the optimal learning rate scales like η∗ ∼ 1/β and the resulting early learning timescale can be written as τ∗z ∼ ‖Z0‖2/β . For all models studied , we observe strong performance for β ∈ [ 10−2 , 101 ] although the specific optimal β is architecture dependent . Emphatically , the optimal β is often far from 1 . For models without batch normalization , smaller β can give stronger results on some training runs , with others failing to train due to instability . Overall , these results suggest that model performance can often be improved by tuning β over the range of [ 10−2 , 101 ] . 2 THEORY . We begin with a precise description of the problem setting before discussing a theory of learning at short times . We will show the following : • The inverse temperature β and logit scale ‖Z0‖ control timescales which determine the rate of change of the loss , the relative change in logits , and the time for learning to leave the linear learning regime . • Small β causes training to access the non-linear learning regime . We will see empirically that increasing access to the non-linear regime can improve generalization . • The largest allowable learning rate is set by the timescale to leave the linearized learning regime , which suggests that networks with small β will train more slowly . All numerical results in this section are using a Wide Resnet ( Zagoruyko and Komodakis , 2017 ) trained on CIFAR10 . 2.1 BASIC MODEL AND NOTATION . We consider a classification task with K classes . For an N dimensional input x , let z ( x , θ ) be the pre-softmax output of a classification model parameterized by θ ∈ RP , such that the classifier predicts the class i corresponding to the largest output value zi . We will mainly consider θ trained by SGD on a training set ( X , Y ) of M input-label pairs . We focus on models trained with cross-entropy loss with a non-trivial inverse temperature β . The softmax-cross-entropy loss can be written as L ( θ , X , Y ) = K∑ i=1 Yi · ln ( σ ( βzi ( X , θ ) ) ) = K∑ i=1 Yi · ln ( σ ( Zi ( X , θ ) ) ) ( 1 ) where we define the rescaled logits Z = βz and σ ( Z ) i = eZi/ ∑ j e Zj is the softmax function . Here Z ( X , θ ) is the M ×K dimensional matrix of rescaled logits on the training set . As we will see later , the statistics of individual σ ( Z ) i will have a strong influence on the learning dynamics . While the statistics of σ ( Z ) i are intractable for intermediate magnitudes , ‖Z‖2 , they can be understood in the limits of large and small ‖Z‖2 . For a fixed model z ( x , θ ) , β controls the certainty of the predicted probabilities . Values of β such that β 1/‖z‖2 will give small values of ‖Z‖2 1 , and the outputs of the softmax will be close to 1/K independent of i ( the maximum-entropy distribution on K classes ) . Larger values of β such that β 1/‖z‖2 will lead to large values of ‖Z‖2 1 ; the resulting distribution has probability close to 1 on one label , and ( exponentially ) close to 0 on the others . The continuous time learning dynamics ( exact in the limit of small learning rate ) are given by : θ̇ = ηβ K∑ i=1 ( ∂zi ( X , θ ( t ) ) ∂θ ) T ( Yi − σ ( Zi ( X , θ ( t ) ) ) ( 2 ) for learning rate η . We will drop the explicit dependence of Zi on θ from here onward , and we will denote time dependence as Zi ( X , t ) explicitly where needed . In function space , the dynamics of the model outputs on an input x are given by dzi ( x ) dt = ηβ K∑ j=1 ( Θ̂θ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) ( 3 ) where we define the M ×M ×K ×K dimensional tensor Θ̂θ , the empirical neural tangent kernel ( NTK ) , as ( Θ̂θ ) ij ( x , X ′ ) ≡ ∂zi ( x ) ∂θ ( ∂zj ( X ) ∂θ ) T ( 4 ) for class indices i and j , which is block-diagonal in the infinite-width limit . From Equation 3 , we see that the early-time dynamics in function space depend on β , the initial softmax input Z ( X , 0 ) on the training set , and the initial Θ̂θ . Changing these observables across a model family will lead to different learning trajectories early in learning . Since significant work has already studied the effects of the NTK , here we focus on the effects of changing β and ‖Z0‖F ≡ ‖Z ( X , 0 ) ‖F ( the norm of the M ×K dimensional matrix of training logits ) , independent of Θ̂θ . 2.2 LINEARIZED DYNAMICS . For small changes in θ , the tangent kernel is approximately constant throughout learning ( Jacot et al. , 2018 ) , and we drop the explicit θ dependence in this subsection . The linearized dynamics of z ( x , t ) only depend on the initial value of Θ̂ and the β-scaled logit values Z ( X , t ) . This suggests that there is a universal timescale across β and η which can be used to compare linearized trajectories with different parameter values . Indeed , if we define an effective learning rate η̃ ≡ ηβ2 , we have dZi ( x ) dt = η̃ K∑ j=1 ( Θ̂ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) ( 5 ) which removes explicit β dependence of the dynamics . We note that a similar rescaling exists for the continuous time versions of other optimizers like momentum ( Appendix B ) . The effective learning rate η̃ is useful for understanding the nonlinear dynamics , as plotting learning curves versus η̃t causes early-time collapse for fixed Z0 across β and η ( Figure 1 ) . We see that there is a strong , monotonic , dependence of the time at which the nonlinear model begins to deviate from its linearization on β . We will return to and explain this phenomenon in Section 2.4 . Unless otherwise noted , we will analyze all timescales in units of η̃ instead of η , as it will allow for the appropriate early-time comparisons between models with different β . 2.3 EARLY LEARNING TIMESCALE . We now define and compute the early learning timescale , τz , that measures the time it takes for the logits to change significantly from their initial value . Specifically , we define τz such that for t τz we expect ‖Z ( x , t ) −Z ( x , 0 ) ‖F ‖Z ( x , 0 ) ‖F and for t τz , ‖Z ( x , t ) −Z ( x , 0 ) ‖F ∼ ‖Z ( x , 0 ) ‖F ( or larger ) . This is synonymous with the timescale over which the model begins to learn . As we will show below , τz ∝ ‖Z0‖F /η̃ . Therefore in units of η̃ , τz only depends on ‖Z0‖F and not β . To see this , note that at very short times it follows from Equation 5 that Zi ( x , t ) − Zi ( x , 0 ) ≈ η̃ K∑ j=1 ( Θ̂ ) ij ( x , X ) ( Yj − σ ( Zj ( X ) ) ) t+O ( t2 ) ( 6 ) It follows that we can define a timescale over which the logits ( on the training set ) change appreciably from their initial value as τz ≡ 1 η̃ ‖Z0‖F ‖Θ̂ ( X , X ) ( Y − σ ( Z0 ) ) ‖F . ( 7 ) where the norms are once again taken across all classes as well as training points . This definition has the desired properties for t τz and t τz . In units of η̃ , τz depends only on ‖Z0‖F , in two ways . The first is a linear scaling in ‖Z0‖F ; the second comes from the contribution from the gradient ‖Θ̂ ( X , X ) ( Y−σ ( Z ( X , 0 ) ) ) ‖F . As previously discussed , since σ ( Z0 ) saturates at small and large values of ‖Z0‖F , it follows that the gradient term will also saturate for large and small ‖Z0‖F , and the ratio of saturating values is some O ( 1 ) constant independent of ‖Z0‖F and β . The quantitative and conceptual nature of τz can both be confirmed numerically . We compute τz explicitly as || [ Zi ( x , t ) − Zi ( x , 0 ) ] /t|| for short times ( Figure 2 , left ) . When plotted over a wide range of ‖Z0‖F and β , the ratio τz/‖Z0‖F ( in rescaled time units ) undergoes a saturating , O ( 1 ) variation from small to large ‖Z0‖F . The quantitative dependence of the transition on the NTK is confirmed in Appendix C. Additionally , for fixed β and varying ‖Z0‖F , rescaling time by 1/τz causes accuracy curves to collapse at early times ( Figure 2 , middle ) , even if they are very different at early times without the rescaling ( right ) . We note here that the late time accuracy curves seem similar across ‖Z0‖F without rescaling , a point which we will return to in Section 3.2 .
This paper investigates how the inverse temperature parameter $\beta$ in the softmax-cross-entropy loss impacts the learning and the generalization. In the theory part, this paper introduces the concepts of early learning timescale and nonlinear timescale, and shows how the learning dynamics depend on the parameter $\beta$. The empirical investigations are carried out with wide Resnets on CIFAR10, Resnet50 on ImageNet, and GRUs on IMDB. The results suggest that the optimal $\beta$ is architecture sensitive.
SP:9002e8827008fb50594757c4aab871b9cb29963b
On Statistical Bias In Active Learning: How and When to Fix It
1 INTRODUCTION . In modern machine learning , unlabelled data can be plentiful while labelling requires scarce resources and expert attention , for example in medical imaging or scientific experimentation . A promising solution to this is active learning—picking the most informative datapoints to label that will hopefully let the model be trained in the most sample-efficient way possible ( Atlas et al. , 1990 ; Settles , 2010 ) . However , active learning has a complication . By picking the most informative labels , the acquired dataset is not drawn from the population distribution . This sampling bias , noted by e.g. , MacKay ( 1992 ) ; Dasgupta & Hsu ( 2008 ) , is worrying : key results in machine learning depend on the training data being identically and independently distributed ( i.i.d . ) samples from the population distribution . For example , we train neural networks by minimizing a Monte Carlo estimator of the population risk . If training data are actively sampled , that estimator is biased and we optimize the wrong objective . The possibility of bias in active learning has been considered by e.g. , Beygelzimer et al . ( 2009 ) ; Chu et al . ( 2011 ) ; Ganti & Gray ( 2012 ) , but the full problem is not well understood . In particular , methods that remove active learning bias have been restricted to special cases , so it has been impossible to even establish whether removing active learning bias is helpful or harmful in typical situations . To this end , we show how to remove the bias introduced by active learning with minimal changes to existing active learning methods . As a stepping stone , we build a Plain Unbiased Risk Estimator , R̃PURE , which applies a corrective weighting to actively sampled datapoints in pool-based active learning . Our Levelled Unbiased Risk Estimator , R̃LURE , builds on this and has lower variance and additional desirable finite-sample properties . We prove that both estimators are unbiased and consistent for arbitrary functions , and characterize their variance . Interestingly , we find—both theoretically and empirically—that our bias corrections can simultaneously also reduce the variance of the estimator , with these gains becoming larger for more effective acquisition strategies . We show that , in turn , these combined benefits can sometimes lead to significant improvements for both model evaluation and training . The benefits are most pronounced in underparameterized models where each datapoint affects the learned function globally . For example , in linear regression adopting our weighting allows better estimates of the parameters with less data . On the other hand , in cases where the model is overparameterized and datapoints mostly affect the learned function locally—like deep neural networks—we find that correcting active learning bias can be ineffective or even harmful during model training . Namely , even though our corrections typically produce strictly superior statistical estimators , we find that the bias from standard active learning can actually be helpful by providing a regularising effect that aids generalization . Through this , our work explains the known empirical successes of existing active learning approaches for training deep models ( Gal et al. , 2017b ; Shen et al. , 2018 ) , despite these ignoring the bias this induces . ∗Equal contribution . Corresponding author sebastian.farquhar @ cs.ox.ac.uk . To summarize , our main contributions are : 1 . We offer a formalization of the problem of statistical bias in active learning . 2 . We introduce active learning risk estimators , R̃PURE and R̃LURE , and prove both are unbiased , consistent , and with variance that can be less than the naive ( biased ) estimator . 3 . Using these , we show that active learning bias can hurt in underparameterized cases like linear regression but help in overparameterized cases like neural networks and explain why . 2 BIAS IN ACTIVE LEARNING . We begin by characterizing the bias introduced by active learning . In supervised learning , generally , we aim to find a decision rule fθ corresponding to inputs , x , and outputs , y , drawn from a population data distribution pdata ( x , y ) which , given a loss function L ( y , fθ ( x ) ) , minimizes the population risk : r = Ex , y∼pdata [ L ( y , fθ ( x ) ) ] . The population risk can not be found exactly , so instead we consider the empirical distribution for some dataset of N points drawn from the population . This gives the empirical risk : an unbiased and consistent estimator of r when the data are drawn i.i.d from pdata and are independent of θ , R̂ = 1 N ∑N n=1 L ( yn , fθ ( xn ) ) . In pool-based active learning ( Lewis & Gale , 1994 ; Settles , 2010 ) , we begin with a large unlabelled dataset , known as the pool dataset Dpool ≡ { xn|1 ≤ n ≤ N } , and sequentially pick the most useful points for which to acquire labels . The lack of most labels means we can not evaluate R̂ directly , so we use the sub-sample empirical risk evaluated using the M actively sampled labelled points : R̃ = 1 M ∑M m=1 L ( ym , fθ ( xm ) ) . ( 1 ) Though almost all active learning research uses this estimator ( see Appendix D ) , it is not an unbiased estimator of either R̂ or r when the M points are actively sampled . Under active—i.e . non–uniform— sampling the M datapoints are not drawn from the population distribution , resulting in a bias which we formally characterize in §4 . See Appendix A for a more general overview of active learning . Note an important distinction between what we will call “ statistical bias ” and “ overfitting bias. ” The bias from active learning above is a statistical bias in the sense that using R̃ biases our estimation of r , regardless of θ . As such , optimizing θ with respect to R̃ induces bias into our optimization of θ . In turn , this breaks any consistency guarantees for our learning process : if we keep M/N fixed , take M →∞ , and optimize for θ , we no longer get the optimal θ that minimizes r. Almost all work on active learning for neural networks currently ignores the issue of statistical bias . However , even without this statistical bias , indeed even if we use R̂ directly , the training process itself also creates an overfitting bias : evaluating the risk using training data induces a dependency between the data and θ . This is why we usually evaluate the risk on held-out test data when doing model selection . Dealing with overfitting bias is beyond the scope of our work as this would equate to solving the problem of generalization . The small amount of prior work which does consider statistical bias in active learning entirely ignores this overfitting bias without commenting on it . In §3-6 , we focus on statistical bias in active learning , so that we can produce estimators that are valid and consistent , and let us optimize the intended objective , not so they can miraculously close the train–test gap . From a more formal perspective , our results all assume that θ is chosen independently of the training data ; an assumption that is almost always ( implicitly ) made in the literature . This ensures our estimators form valid objectives , but also has important implications that are typically overlooked . We return to this in §7 , examining the interaction between statistical and overfitting bias . 3 UNBIASED ACTIVE LEARNING : R̃PURE AND R̃LURE . We now show how to unbiasedly estimate the risk in the form of a weighted expectation over actively sampled data points . We denote the set of actively sampled points Dtrain ≡ { ( xm , ym ) |1 ≤ m ≤M } , where ∀m : xm ∈ Dpool . We begin by building a “ plain ” unbiased risk estimator , R̃PURE , as a stepping stone—its construction is quite natural in that each term is individually an unbiased estimator of the risk . We then use it to construct a “ levelled ” unbiased risk estimator , R̃LURE , which is an unbiased and consistent estimator of the population risk just like R̃PURE , but which reweights individual terms to produce lower variance and resolve some pathologies of the first approach . Both estimators are easy to implement and have trivial compute/memory requirements . 3.1 R̃PURE : PLAIN UNBIASED RISK ESTIMATOR . For our estimators , we introduce an active sampling proposal distribution over indices rather than the more typical distribution over datapoints . This simplifies our proofs , but the two are algorithmically equivalent for pool-based active learning because of the one–to–one relationship between datapoints and indices . We define the probability mass for each index being the next to be sampled , once Dtrain contains m− 1 points , as q ( im ; i1 : m−1 , Dpool ) . Because we are learning actively , the proposal distribution depends on the indices sampled so far ( i1 : m−1 ) and the available data ( Dpool , note though that it does not depend on the labels of unsampled points ) . The only requirement on this proposal distribution for our theoretical results is that it must place non-zero probability on all of the training data : anything else necessarily introduces bias . Considerations for the acquisition proposal distribution are discussed further in §3.3 . We first present the estimator before proving the main results : R̃PURE ≡ 1 M ∑M m=1 am ; where am ≡ wmLim + 1 N ∑m−1 t=1 Lit , ( 2 ) where the loss at a point Lim ≡ L ( yim , fθ ( xim ) ) , the weights wm ≡ 1/Nq ( im ; i1 : m−1 , Dpool ) and im ∼ q ( im ; i1 : m−1 , Dpool ) . For practical implementation , R̃PURE can further be written in the following more computationally friendly form that avoids a double summation : R̃PURE = 1 M M∑ m=1 ( 1 Nq ( im ; i1 : m−1 , Dpool ) + M −m N ) Lim . ( 3 ) However , we focus on the first form for our analysis because am in ( 2 ) has some beneficial properties not shared by the weighting factors in ( 3 ) . In particular , in Appendix B.1 we prove that : Lemma 1 . The individual terms am of R̃PURE are unbiased estimators of the risk : E [ am ] = r. The motivation for the construction of am directly originates from constructing an estimator where Lemma 1 holds while only making use of the observed losses Li1 , . . . , Lim , taking care with the fact that each new proposal distribution does not have support over points that have already been acquired . Except for trivial problems , am is essentially unique in this regard ; naive importance sampling ( i.e . 1M ∑M m=1 wmLim ) does not lead to an unbiased , or even consistent , estimator . However , the overall estimator R̃PURE is not the only unbiased estimator of the risk , as we discuss in §3.2 . We can now characterize the behaviour of R̃PURE as follows ( see Appendix B.2 for proof ) Theorem 1 . R̃PURE as defined above has the properties : E [ R̃PURE ] = r , Var [ R̃PURE ] = Var [ L ( y , fθ ( x ) ) ] N + 1 M2 M∑ m=1 EDpool , i1 : m−1 [ Var [ wmLim |i1 : m−1 , Dpool ] ] . ( 4 ) Remark 1 . The first term of ( 4 ) is the variance of the loss on the whole pool , while the second term accounts for the variance originating from the active sampling itself given the pool . This second term is O ( N/M ) times larger and so will generally dominate in practice as typically M N . Armed with Theorem 1 , we can prove the consistency of R̃PURE under standard assumptions : R̃PURE converges in expectation ( i.e . its mean squared error tends to zero ) as M →∞ under the assumptions that N > M , L ( y , fθ ( x ) ) is integrable , and q ( im ; i1 : m−1 , Dpool ) is a valid proposal in the sense that it puts non-zero mass on each unlabelled datapoint . Formally , as proved in Appendix B.3 , Theorem 2 . Let α = N/M and assume that α > 1 . If E [ L ( y , fθ ( x ) ) 2 ] < ∞ and ∃β > 0 : min n∈ { 1 : N\i1 : m−1 } q ( im = n ; i1 : m−1 , Dpool ) ≥ β/N ∀N ∈ Z+ , m ≤ N , then R̃PURE converges in its L2 norm to r as M →∞ , i.e. , limM→∞ E [ ( R̃PURE − r ) 2 ] = 0 .
The authors consider the bias (in the risk) introduced by active sampling strategies with respect to the true underlying data generating distribution. They then propose two estimators of the risk -- SURE and PURE -- that are unbiased and asymptotically consistent under certain assumptions. The authors consider two toy examples where they show the existence of active learning bias, and the effect of removing this. In particular, the authors notice that while training a linear regression (based on actively acquired datapoints) with their unbiased risks improves test loss, the opposite happens for a Bayesian Neural Network (BNN). They then provide a potential explanation for this phenomenon.
SP:8facdf5c306fe8f0e82a7072ebb51ce7efd0df7f
On Statistical Bias In Active Learning: How and When to Fix It
1 INTRODUCTION . In modern machine learning , unlabelled data can be plentiful while labelling requires scarce resources and expert attention , for example in medical imaging or scientific experimentation . A promising solution to this is active learning—picking the most informative datapoints to label that will hopefully let the model be trained in the most sample-efficient way possible ( Atlas et al. , 1990 ; Settles , 2010 ) . However , active learning has a complication . By picking the most informative labels , the acquired dataset is not drawn from the population distribution . This sampling bias , noted by e.g. , MacKay ( 1992 ) ; Dasgupta & Hsu ( 2008 ) , is worrying : key results in machine learning depend on the training data being identically and independently distributed ( i.i.d . ) samples from the population distribution . For example , we train neural networks by minimizing a Monte Carlo estimator of the population risk . If training data are actively sampled , that estimator is biased and we optimize the wrong objective . The possibility of bias in active learning has been considered by e.g. , Beygelzimer et al . ( 2009 ) ; Chu et al . ( 2011 ) ; Ganti & Gray ( 2012 ) , but the full problem is not well understood . In particular , methods that remove active learning bias have been restricted to special cases , so it has been impossible to even establish whether removing active learning bias is helpful or harmful in typical situations . To this end , we show how to remove the bias introduced by active learning with minimal changes to existing active learning methods . As a stepping stone , we build a Plain Unbiased Risk Estimator , R̃PURE , which applies a corrective weighting to actively sampled datapoints in pool-based active learning . Our Levelled Unbiased Risk Estimator , R̃LURE , builds on this and has lower variance and additional desirable finite-sample properties . We prove that both estimators are unbiased and consistent for arbitrary functions , and characterize their variance . Interestingly , we find—both theoretically and empirically—that our bias corrections can simultaneously also reduce the variance of the estimator , with these gains becoming larger for more effective acquisition strategies . We show that , in turn , these combined benefits can sometimes lead to significant improvements for both model evaluation and training . The benefits are most pronounced in underparameterized models where each datapoint affects the learned function globally . For example , in linear regression adopting our weighting allows better estimates of the parameters with less data . On the other hand , in cases where the model is overparameterized and datapoints mostly affect the learned function locally—like deep neural networks—we find that correcting active learning bias can be ineffective or even harmful during model training . Namely , even though our corrections typically produce strictly superior statistical estimators , we find that the bias from standard active learning can actually be helpful by providing a regularising effect that aids generalization . Through this , our work explains the known empirical successes of existing active learning approaches for training deep models ( Gal et al. , 2017b ; Shen et al. , 2018 ) , despite these ignoring the bias this induces . ∗Equal contribution . Corresponding author sebastian.farquhar @ cs.ox.ac.uk . To summarize , our main contributions are : 1 . We offer a formalization of the problem of statistical bias in active learning . 2 . We introduce active learning risk estimators , R̃PURE and R̃LURE , and prove both are unbiased , consistent , and with variance that can be less than the naive ( biased ) estimator . 3 . Using these , we show that active learning bias can hurt in underparameterized cases like linear regression but help in overparameterized cases like neural networks and explain why . 2 BIAS IN ACTIVE LEARNING . We begin by characterizing the bias introduced by active learning . In supervised learning , generally , we aim to find a decision rule fθ corresponding to inputs , x , and outputs , y , drawn from a population data distribution pdata ( x , y ) which , given a loss function L ( y , fθ ( x ) ) , minimizes the population risk : r = Ex , y∼pdata [ L ( y , fθ ( x ) ) ] . The population risk can not be found exactly , so instead we consider the empirical distribution for some dataset of N points drawn from the population . This gives the empirical risk : an unbiased and consistent estimator of r when the data are drawn i.i.d from pdata and are independent of θ , R̂ = 1 N ∑N n=1 L ( yn , fθ ( xn ) ) . In pool-based active learning ( Lewis & Gale , 1994 ; Settles , 2010 ) , we begin with a large unlabelled dataset , known as the pool dataset Dpool ≡ { xn|1 ≤ n ≤ N } , and sequentially pick the most useful points for which to acquire labels . The lack of most labels means we can not evaluate R̂ directly , so we use the sub-sample empirical risk evaluated using the M actively sampled labelled points : R̃ = 1 M ∑M m=1 L ( ym , fθ ( xm ) ) . ( 1 ) Though almost all active learning research uses this estimator ( see Appendix D ) , it is not an unbiased estimator of either R̂ or r when the M points are actively sampled . Under active—i.e . non–uniform— sampling the M datapoints are not drawn from the population distribution , resulting in a bias which we formally characterize in §4 . See Appendix A for a more general overview of active learning . Note an important distinction between what we will call “ statistical bias ” and “ overfitting bias. ” The bias from active learning above is a statistical bias in the sense that using R̃ biases our estimation of r , regardless of θ . As such , optimizing θ with respect to R̃ induces bias into our optimization of θ . In turn , this breaks any consistency guarantees for our learning process : if we keep M/N fixed , take M →∞ , and optimize for θ , we no longer get the optimal θ that minimizes r. Almost all work on active learning for neural networks currently ignores the issue of statistical bias . However , even without this statistical bias , indeed even if we use R̂ directly , the training process itself also creates an overfitting bias : evaluating the risk using training data induces a dependency between the data and θ . This is why we usually evaluate the risk on held-out test data when doing model selection . Dealing with overfitting bias is beyond the scope of our work as this would equate to solving the problem of generalization . The small amount of prior work which does consider statistical bias in active learning entirely ignores this overfitting bias without commenting on it . In §3-6 , we focus on statistical bias in active learning , so that we can produce estimators that are valid and consistent , and let us optimize the intended objective , not so they can miraculously close the train–test gap . From a more formal perspective , our results all assume that θ is chosen independently of the training data ; an assumption that is almost always ( implicitly ) made in the literature . This ensures our estimators form valid objectives , but also has important implications that are typically overlooked . We return to this in §7 , examining the interaction between statistical and overfitting bias . 3 UNBIASED ACTIVE LEARNING : R̃PURE AND R̃LURE . We now show how to unbiasedly estimate the risk in the form of a weighted expectation over actively sampled data points . We denote the set of actively sampled points Dtrain ≡ { ( xm , ym ) |1 ≤ m ≤M } , where ∀m : xm ∈ Dpool . We begin by building a “ plain ” unbiased risk estimator , R̃PURE , as a stepping stone—its construction is quite natural in that each term is individually an unbiased estimator of the risk . We then use it to construct a “ levelled ” unbiased risk estimator , R̃LURE , which is an unbiased and consistent estimator of the population risk just like R̃PURE , but which reweights individual terms to produce lower variance and resolve some pathologies of the first approach . Both estimators are easy to implement and have trivial compute/memory requirements . 3.1 R̃PURE : PLAIN UNBIASED RISK ESTIMATOR . For our estimators , we introduce an active sampling proposal distribution over indices rather than the more typical distribution over datapoints . This simplifies our proofs , but the two are algorithmically equivalent for pool-based active learning because of the one–to–one relationship between datapoints and indices . We define the probability mass for each index being the next to be sampled , once Dtrain contains m− 1 points , as q ( im ; i1 : m−1 , Dpool ) . Because we are learning actively , the proposal distribution depends on the indices sampled so far ( i1 : m−1 ) and the available data ( Dpool , note though that it does not depend on the labels of unsampled points ) . The only requirement on this proposal distribution for our theoretical results is that it must place non-zero probability on all of the training data : anything else necessarily introduces bias . Considerations for the acquisition proposal distribution are discussed further in §3.3 . We first present the estimator before proving the main results : R̃PURE ≡ 1 M ∑M m=1 am ; where am ≡ wmLim + 1 N ∑m−1 t=1 Lit , ( 2 ) where the loss at a point Lim ≡ L ( yim , fθ ( xim ) ) , the weights wm ≡ 1/Nq ( im ; i1 : m−1 , Dpool ) and im ∼ q ( im ; i1 : m−1 , Dpool ) . For practical implementation , R̃PURE can further be written in the following more computationally friendly form that avoids a double summation : R̃PURE = 1 M M∑ m=1 ( 1 Nq ( im ; i1 : m−1 , Dpool ) + M −m N ) Lim . ( 3 ) However , we focus on the first form for our analysis because am in ( 2 ) has some beneficial properties not shared by the weighting factors in ( 3 ) . In particular , in Appendix B.1 we prove that : Lemma 1 . The individual terms am of R̃PURE are unbiased estimators of the risk : E [ am ] = r. The motivation for the construction of am directly originates from constructing an estimator where Lemma 1 holds while only making use of the observed losses Li1 , . . . , Lim , taking care with the fact that each new proposal distribution does not have support over points that have already been acquired . Except for trivial problems , am is essentially unique in this regard ; naive importance sampling ( i.e . 1M ∑M m=1 wmLim ) does not lead to an unbiased , or even consistent , estimator . However , the overall estimator R̃PURE is not the only unbiased estimator of the risk , as we discuss in §3.2 . We can now characterize the behaviour of R̃PURE as follows ( see Appendix B.2 for proof ) Theorem 1 . R̃PURE as defined above has the properties : E [ R̃PURE ] = r , Var [ R̃PURE ] = Var [ L ( y , fθ ( x ) ) ] N + 1 M2 M∑ m=1 EDpool , i1 : m−1 [ Var [ wmLim |i1 : m−1 , Dpool ] ] . ( 4 ) Remark 1 . The first term of ( 4 ) is the variance of the loss on the whole pool , while the second term accounts for the variance originating from the active sampling itself given the pool . This second term is O ( N/M ) times larger and so will generally dominate in practice as typically M N . Armed with Theorem 1 , we can prove the consistency of R̃PURE under standard assumptions : R̃PURE converges in expectation ( i.e . its mean squared error tends to zero ) as M →∞ under the assumptions that N > M , L ( y , fθ ( x ) ) is integrable , and q ( im ; i1 : m−1 , Dpool ) is a valid proposal in the sense that it puts non-zero mass on each unlabelled datapoint . Formally , as proved in Appendix B.3 , Theorem 2 . Let α = N/M and assume that α > 1 . If E [ L ( y , fθ ( x ) ) 2 ] < ∞ and ∃β > 0 : min n∈ { 1 : N\i1 : m−1 } q ( im = n ; i1 : m−1 , Dpool ) ≥ β/N ∀N ∈ Z+ , m ≤ N , then R̃PURE converges in its L2 norm to r as M →∞ , i.e. , limM→∞ E [ ( R̃PURE − r ) 2 ] = 0 .
This paper analyzes the bias of models in pool-based active learning settings where the sampling procedure is probabilistic (non-deterministic). It proposes two unbiased estimators of the population risk that weight the loss for each sampled data point. Empirical experiments demonstrate that these unbiased estimators work well for active learning settings with under-parameterized models, but are less effective for over-parameterized models. For the latter case, the authors provide meaningful insights into why biased estimators of population risk may actually be beneficial for over-parameterized models.
SP:8facdf5c306fe8f0e82a7072ebb51ce7efd0df7f
Towards certifying $\ell_\infty$ robustness using Neural networks with $\ell_\infty$-dist Neurons
1 INTRODUCTION . Modern neural networks are usually sensitive to small , adversarially chosen perturbations to the inputs ( Szegedy et al. , 2013 ; Biggio et al. , 2013 ) . Given an image x that is correctly classified by a neural network , a malicious attacker may find a small adversarial perturbation δ such that the perturbed image x + δ , though visually indistinguishable from the original image , is assigned to a wrong class with high confidence by the network . Such vulnerability creates security concerns in many real-world applications . Developing a model that can resist small ` ∞ perturbations has been extensively studied in the literature . Adversarial training methods ( Szegedy et al. , 2013 ; Madry et al. , 2017 ; Goodfellow et al. , 2015 ; Huang et al. , 2015 ; Athalye et al. , 2018 ; Ding et al. , 2020 ) first learn on-the-fly adversarial examples of the inputs , and then update model parameters using these perturbed samples together with the original labels . Such approaches are restricted to a particular ( class of ) attack method and can not be formally guaranteed whether the resulting model is robust against other attacks . Another line of algorithms trains robust models by maximizing the certified radius provided by robust certification methods . Weng et al . ( 2018 ) ; Wong & Kolter ( 2018a ) ; Zhang et al . ( 2018 ) ; Mirman et al . ( 2018 ) ; Wang et al . ( 2018 ) ; Gowal et al . ( 2018 ) ; Zhang et al . ( 2019b ) develop their methods based on linear or convex relaxations of fully connected ReLU networks . However , the certification methods are usually computationally expensive and can only handle ReLU activations . Cohen et al . ( 2019 ) ; Salman et al . ( 2019 ) ; Zhai et al . ( 2020 ) show that a certified guarantee on small ` 2 perturbations can be easily computed for general Gaussian smoothed classifiers . But recent works suggest that such methods are hard to extend to the ` ∞-perturbation scenario . In this work , we overcome the challenge mentioned above by introducing a new type of neural network that naturally resists local adversarial attacks and can be easily certified under the ` ∞ perturbation . In particular , we propose a novel neuron called ` ∞-dist neuron . Unlike the standard neuron design that uses a non-linear activation after a linear transformation , the ` ∞-dist neuron is purely based on computing the ` ∞ distance between the inputs and the parameters . It is straightfor- ward to see that such a neuron is 1-Lipschitz with respect to the ` ∞ norm and the neural networks constructed with ` ∞-dist neuron ( ` ∞-dist Nets ) enjoy the same property . Based on such a property , we can obtain the certified robustness for any ` ∞-dist Nets using the margin of the prediction outputs . Theoretically , we investigate the expressive power of ` ∞-dist Nets and its adversarially robust generalization ability . We first prove a Lipschitz-universal approximation theorem for ` ∞-dist Net using a structured approach , which shows that ` ∞-dist Nets can approximate any 1-Lipschitz function with respect to ` ∞ norm . We then give upper bounds of robust test error based on the Rademacher complexity , which shows that the robust test error would be small if the ` ∞-dist Net learns a large margin classifier on the training data . Both results demonstrate the excellent capability and generalization ability of the ` ∞-dist Net function class . The ` ∞-dist Nets have nice theoretical guarantees , but empirically , training an ` ∞-dist Net is not easy . For example , the gradient of the parameters in the ` ∞ norm is sparse , which makes the optimization inefficient . We show how to initialize the model parameters , apply proper normalization , and overcome the sparse gradient problem via smoothed approximated gradients . Preliminary experiments on MNIST and Fashion-MNIST show that even without using adversarial training , the learned networks are already provably robust . Our contributions are summarized as follows : • We propose a novel neural network using ` ∞-dist neurons , called ` ∞-dist Nets . Theoretically , – In Section 3 , we show that ` ∞-dist Nets are 1-Lipschitz with respect to the ` ∞ norm in nature , which directly guarantees the certified robustness of any ` ∞-dist Net ( with respect to the ` ∞ norm ) . – In Section 4.1 , we prove that ` ∞-dist Nets have good expressive power as it can approximate any 1-Lipschitz function with respect to the ` ∞ norm . – In Section 4.2 , we prove that ` ∞-dist Nets have good generalization ability as the robust test error can be upper-bounded by the performance of a large margin classifier on the training data . • We provide several implementation strategies which are shown to be practically helpful for model training ( in Section 5 ) . 2 RELATED WORKS . There are two major lines of works seeking to get robust neural networks : Robust Training Approaches . Previous works showed that the conventional neural networks learned using standard training approaches ( e.g. , maximum likelihood method ) are sensitive to small adversarial perturbations , and significant efforts have been put on developing training approaches for learning robust models . Adversarial training is the most successful method against adversarial attacks . By adding adversarial examples to the training set on the fly , adversarial training methods ( Szegedy et al. , 2013 ; Goodfellow et al. , 2015 ; Huang et al. , 2015 ; Zhang et al. , 2019a ; Wong et al. , 2020 ) can significantly improve the robustness of the conventional neural networks . However , all the methods above are evaluated according to the empirical robust accuracy against pre-defined adversarial attack algorithms , such as projected gradient decent . It can not be formally guaranteed whether the resulting model is also robust against other attacks . Certified Robustness . Many recent works focus on certifying the robustness of learned neural networks under any attack . Approaches based on bounding the certified radius layer by layer using some convex relaxation methods have been proposed for certifying the robustness of neural networks ( Wong & Kolter , 2018b ; Gowal et al. , 2018 ; Mirman et al. , 2018 ; Dvijotham et al. , 2018 ; Raghunathan et al. , 2018 ; Zhang et al. , 2020 ) . However , such approaches are usually computationally expensive and have difficulties in scaling to deep models . More recently , researchers found a new approach called randomized smoothing that can provide a certified robustness guarantee for general models . Lecuyer et al . ( 2018 ) ; Li et al . ( 2018 ) ; Cohen et al . ( 2019 ) ; Salman et al . ( 2019 ) ; Zhai et al . ( 2020 ) showed that if a Gaussian random noise is added to the input layer , a certified guarantee on small ` 2 perturbations can be computed for Gaussian smoothed classifiers . However , Yang et al . ( 2020 ) ; Blum et al . ( 2020 ) ; Kumar et al . ( 2020 ) showed that randomized smoothing can not achieve nontrivial certified accuracy against more than Ω ( min ( 1 , d1/p−1/2 ) ) radius for ` p perturbations , where d is the input dimension , therefore it can not provide meaningful results for ` ∞ perturbations due to the curse of dimensionality . Another line of more conservative certification approaches sought to bound the global Lipschitz constant of the neural network ( Gouk et al. , 2018 ; Tsuzuku et al. , 2018 ; Anil et al. , 2019 ; Cisse et al. , 2017 ) . However , the bounds are not tight ( Cohen et al. , 2019 ) , and the final robustness performances are not as good as other certification methods . 3 ` ∞-DIST NETWORK AND ITS ROBUSTNESS GUARANTEE . 3.1 PRELIMINARIES . Throughout this paper , we will use bold letters to denote vectors and otherwise scalars . Consider a standard classification task with an underlying data distribution D over pairs of examples x ∈ X and corresponding labels y ∈ Y = { 1 , 2 , · · · , M } . Usually D is unknown and we can only access a training set T = { ( x1 , y1 ) , · · · , ( xn , yn ) } in which ( xi , yi ) is i.i.d . drawn from D , i = 1 , 2 , · · · , n. Let f ∈ F be the classifier of interest that maps any x ∈ X to Y . We call x′ = x+δ an adversarial example of x to classifier f if f can correctly classify x but assigns a different label to x′ . In real practice , the most commonly used setting is to consider the attack under -bounded ` ∞ norm constraint , i.e. , δ satisfies ‖δ‖∞ ≤ , which is also called ` ∞ perturbations . Our goal is to learn a model from T that can resist attacks at ( x , y ) with high probability over ( x , y ) ∼ D for any small ` ∞ perturbations . It relates to compute the radius of the largest ` ∞ ball centered at x in which f does not change its prediction . This radius is called the robust radius , which is defined as ( Zhai et al. , 2020 ; Zhang et al. , 2019a ) : R ( f ; x , y ) = { inf f ( x′ ) 6=f ( x ) ‖x′ − x‖∞ , when f ( x ) = y 0 , when f ( x ) 6= y ( 1 ) Unfortunately , computing the robust radius ( 1 ) of a classifier induced by a standard deep neural network is very difficult . For example , Weng et al . ( 2018 ) showed that computing the ` p robust radius of a deep neural network is NP-hard for some specific p. Researchers then seek to derive a tight lower bound of R ( f ; x , y ) for general f . This lower bound is called certified radius and we denote it as CR ( f ; x , y ) . The certified radius satisfies 0 ≤ CR ( f ; x , y ) ≤ R ( f ; x , y ) for any f , x , y . 3.2 NETWORKS WITH ` ∞-DIST NEURONS . In this subsection , we propose the ` ∞-dist Neuron that is inherently Lipschitz with respect to ` ∞ norm . Using these neurons as building blocks , we then show how to obtain an ` ∞-Lipschitz neural networks dubbed ` ∞-dist Net . Denote z as the input vector to a neuron . A standard neuron processes the input by first projecting z to a scalar value using a linear transformation , and then applying an non-linear activation function σ on it , i.e. , σ ( w > z + b ) . w and b are parameters , and function σ can be the sigmoid or ReLU activation . Unlike the previous design paradigm , we introduce a new type of neuron using ` ∞ distance as the basic operation , which we call ` ∞-dist neuron : u ( z , θ ) = ‖z −w‖∞ + b , ( 2 ) where θ = { w , b } is the parameter set . From the above equation , we can see that the ` ∞-dist neuron is non-linear as it calculates the ` ∞ distance between input z and parameter w with a bias term b . As a result , there is no need to further apply a non-linear activation function . Without loss of generality , we study the properties of multi-layer perceptron ( MLP ) networks that are constructed using ` ∞-dist neurons . All theoretical results can be easily extended to other neural network architectures , such as convolutional neural nets . We use x ∈ Rdinput to denote the input vector of an MLP network . A ( MLP ) network using ` ∞-dist neurons can be formally defined as follows . Definition 3.1 . ( ` ∞-dist Net ) Denote g as an MLP network which takes x ( 1 ) , x ∈ Rdinput as input . Assume there are L hidden layers and the l-th hidden layer contains dl hidden units . We call g is an MLP network constructed by ` ∞-dist neurons , if the k-th unit in the l-th hidden layer x ( l+1 ) k is computed by x ( l+1 ) k = u ( x ( l ) , θ ( l , k ) ) = ‖x ( l ) −w ( l , k ) ‖∞ + b ( l , k ) , 0 < l ≤ L , 0 < k ≤ dl , where x ( l ) = ( x ( l ) 1 , x ( l ) 2 , · · · , x ( l ) dl−1 ) is the input vector to the l-th hidden layer . For simplicity , we will call an MLP network constructed by ` ∞-dist neurons as ` ∞-dist Net . For classification tasks , the dimensionality of the output of g matches the number of categories , i.e. , M . We write g ( x ) = ( g1 ( x ) , g2 ( x ) , · · · , gM ( x ) ) and define the predictor f ( x ) = arg maxi∈ [ M ] gi ( x ) . Note that g ( x ) can be used as the output logits the same as in any other networks , so we can apply any standard loss function on the ` ∞-dist Net , such as the cross-entropy loss or hinge loss . We will further show that the ` ∞-dist neuron and the neural networks constructed using it have nice theoretical properties to control the robustness of the model . For completeness , we first introduce the definition of Lipschitz functions as below . Definition 3.2 . ( Lipschitz Function ) A function g ( z ) : Rm → Rn is called λ-Lipschitz with respect to ` p norm ‖ · ‖p , if for any z1 , z2 , the following holds : ‖g ( z1 ) − g ( z2 ) ‖p ≤ λ‖z1 − z2‖p It is straightforward to see that the ` ∞-dist neuron is 1-Lipschitz with respect to ` ∞ norm .
In this paper, the authors consider the task of adversarial/robust learning with respect to neural networks. The problem is a well-motivated one: suppose there is a neural network that on input a training set T={(x_i,y_i)} does a good classification job, but an adversary comes along and modifies some parts of T, then it is very possible that the neural network will classify almost incorrectly and hence isn't robust. In this paper they consider this setting and ask if we can naturally make neural networks robust. 
SP:a84853c2ccc676838a77ef3323d5eb60fb5b638b
Towards certifying $\ell_\infty$ robustness using Neural networks with $\ell_\infty$-dist Neurons
1 INTRODUCTION . Modern neural networks are usually sensitive to small , adversarially chosen perturbations to the inputs ( Szegedy et al. , 2013 ; Biggio et al. , 2013 ) . Given an image x that is correctly classified by a neural network , a malicious attacker may find a small adversarial perturbation δ such that the perturbed image x + δ , though visually indistinguishable from the original image , is assigned to a wrong class with high confidence by the network . Such vulnerability creates security concerns in many real-world applications . Developing a model that can resist small ` ∞ perturbations has been extensively studied in the literature . Adversarial training methods ( Szegedy et al. , 2013 ; Madry et al. , 2017 ; Goodfellow et al. , 2015 ; Huang et al. , 2015 ; Athalye et al. , 2018 ; Ding et al. , 2020 ) first learn on-the-fly adversarial examples of the inputs , and then update model parameters using these perturbed samples together with the original labels . Such approaches are restricted to a particular ( class of ) attack method and can not be formally guaranteed whether the resulting model is robust against other attacks . Another line of algorithms trains robust models by maximizing the certified radius provided by robust certification methods . Weng et al . ( 2018 ) ; Wong & Kolter ( 2018a ) ; Zhang et al . ( 2018 ) ; Mirman et al . ( 2018 ) ; Wang et al . ( 2018 ) ; Gowal et al . ( 2018 ) ; Zhang et al . ( 2019b ) develop their methods based on linear or convex relaxations of fully connected ReLU networks . However , the certification methods are usually computationally expensive and can only handle ReLU activations . Cohen et al . ( 2019 ) ; Salman et al . ( 2019 ) ; Zhai et al . ( 2020 ) show that a certified guarantee on small ` 2 perturbations can be easily computed for general Gaussian smoothed classifiers . But recent works suggest that such methods are hard to extend to the ` ∞-perturbation scenario . In this work , we overcome the challenge mentioned above by introducing a new type of neural network that naturally resists local adversarial attacks and can be easily certified under the ` ∞ perturbation . In particular , we propose a novel neuron called ` ∞-dist neuron . Unlike the standard neuron design that uses a non-linear activation after a linear transformation , the ` ∞-dist neuron is purely based on computing the ` ∞ distance between the inputs and the parameters . It is straightfor- ward to see that such a neuron is 1-Lipschitz with respect to the ` ∞ norm and the neural networks constructed with ` ∞-dist neuron ( ` ∞-dist Nets ) enjoy the same property . Based on such a property , we can obtain the certified robustness for any ` ∞-dist Nets using the margin of the prediction outputs . Theoretically , we investigate the expressive power of ` ∞-dist Nets and its adversarially robust generalization ability . We first prove a Lipschitz-universal approximation theorem for ` ∞-dist Net using a structured approach , which shows that ` ∞-dist Nets can approximate any 1-Lipschitz function with respect to ` ∞ norm . We then give upper bounds of robust test error based on the Rademacher complexity , which shows that the robust test error would be small if the ` ∞-dist Net learns a large margin classifier on the training data . Both results demonstrate the excellent capability and generalization ability of the ` ∞-dist Net function class . The ` ∞-dist Nets have nice theoretical guarantees , but empirically , training an ` ∞-dist Net is not easy . For example , the gradient of the parameters in the ` ∞ norm is sparse , which makes the optimization inefficient . We show how to initialize the model parameters , apply proper normalization , and overcome the sparse gradient problem via smoothed approximated gradients . Preliminary experiments on MNIST and Fashion-MNIST show that even without using adversarial training , the learned networks are already provably robust . Our contributions are summarized as follows : • We propose a novel neural network using ` ∞-dist neurons , called ` ∞-dist Nets . Theoretically , – In Section 3 , we show that ` ∞-dist Nets are 1-Lipschitz with respect to the ` ∞ norm in nature , which directly guarantees the certified robustness of any ` ∞-dist Net ( with respect to the ` ∞ norm ) . – In Section 4.1 , we prove that ` ∞-dist Nets have good expressive power as it can approximate any 1-Lipschitz function with respect to the ` ∞ norm . – In Section 4.2 , we prove that ` ∞-dist Nets have good generalization ability as the robust test error can be upper-bounded by the performance of a large margin classifier on the training data . • We provide several implementation strategies which are shown to be practically helpful for model training ( in Section 5 ) . 2 RELATED WORKS . There are two major lines of works seeking to get robust neural networks : Robust Training Approaches . Previous works showed that the conventional neural networks learned using standard training approaches ( e.g. , maximum likelihood method ) are sensitive to small adversarial perturbations , and significant efforts have been put on developing training approaches for learning robust models . Adversarial training is the most successful method against adversarial attacks . By adding adversarial examples to the training set on the fly , adversarial training methods ( Szegedy et al. , 2013 ; Goodfellow et al. , 2015 ; Huang et al. , 2015 ; Zhang et al. , 2019a ; Wong et al. , 2020 ) can significantly improve the robustness of the conventional neural networks . However , all the methods above are evaluated according to the empirical robust accuracy against pre-defined adversarial attack algorithms , such as projected gradient decent . It can not be formally guaranteed whether the resulting model is also robust against other attacks . Certified Robustness . Many recent works focus on certifying the robustness of learned neural networks under any attack . Approaches based on bounding the certified radius layer by layer using some convex relaxation methods have been proposed for certifying the robustness of neural networks ( Wong & Kolter , 2018b ; Gowal et al. , 2018 ; Mirman et al. , 2018 ; Dvijotham et al. , 2018 ; Raghunathan et al. , 2018 ; Zhang et al. , 2020 ) . However , such approaches are usually computationally expensive and have difficulties in scaling to deep models . More recently , researchers found a new approach called randomized smoothing that can provide a certified robustness guarantee for general models . Lecuyer et al . ( 2018 ) ; Li et al . ( 2018 ) ; Cohen et al . ( 2019 ) ; Salman et al . ( 2019 ) ; Zhai et al . ( 2020 ) showed that if a Gaussian random noise is added to the input layer , a certified guarantee on small ` 2 perturbations can be computed for Gaussian smoothed classifiers . However , Yang et al . ( 2020 ) ; Blum et al . ( 2020 ) ; Kumar et al . ( 2020 ) showed that randomized smoothing can not achieve nontrivial certified accuracy against more than Ω ( min ( 1 , d1/p−1/2 ) ) radius for ` p perturbations , where d is the input dimension , therefore it can not provide meaningful results for ` ∞ perturbations due to the curse of dimensionality . Another line of more conservative certification approaches sought to bound the global Lipschitz constant of the neural network ( Gouk et al. , 2018 ; Tsuzuku et al. , 2018 ; Anil et al. , 2019 ; Cisse et al. , 2017 ) . However , the bounds are not tight ( Cohen et al. , 2019 ) , and the final robustness performances are not as good as other certification methods . 3 ` ∞-DIST NETWORK AND ITS ROBUSTNESS GUARANTEE . 3.1 PRELIMINARIES . Throughout this paper , we will use bold letters to denote vectors and otherwise scalars . Consider a standard classification task with an underlying data distribution D over pairs of examples x ∈ X and corresponding labels y ∈ Y = { 1 , 2 , · · · , M } . Usually D is unknown and we can only access a training set T = { ( x1 , y1 ) , · · · , ( xn , yn ) } in which ( xi , yi ) is i.i.d . drawn from D , i = 1 , 2 , · · · , n. Let f ∈ F be the classifier of interest that maps any x ∈ X to Y . We call x′ = x+δ an adversarial example of x to classifier f if f can correctly classify x but assigns a different label to x′ . In real practice , the most commonly used setting is to consider the attack under -bounded ` ∞ norm constraint , i.e. , δ satisfies ‖δ‖∞ ≤ , which is also called ` ∞ perturbations . Our goal is to learn a model from T that can resist attacks at ( x , y ) with high probability over ( x , y ) ∼ D for any small ` ∞ perturbations . It relates to compute the radius of the largest ` ∞ ball centered at x in which f does not change its prediction . This radius is called the robust radius , which is defined as ( Zhai et al. , 2020 ; Zhang et al. , 2019a ) : R ( f ; x , y ) = { inf f ( x′ ) 6=f ( x ) ‖x′ − x‖∞ , when f ( x ) = y 0 , when f ( x ) 6= y ( 1 ) Unfortunately , computing the robust radius ( 1 ) of a classifier induced by a standard deep neural network is very difficult . For example , Weng et al . ( 2018 ) showed that computing the ` p robust radius of a deep neural network is NP-hard for some specific p. Researchers then seek to derive a tight lower bound of R ( f ; x , y ) for general f . This lower bound is called certified radius and we denote it as CR ( f ; x , y ) . The certified radius satisfies 0 ≤ CR ( f ; x , y ) ≤ R ( f ; x , y ) for any f , x , y . 3.2 NETWORKS WITH ` ∞-DIST NEURONS . In this subsection , we propose the ` ∞-dist Neuron that is inherently Lipschitz with respect to ` ∞ norm . Using these neurons as building blocks , we then show how to obtain an ` ∞-Lipschitz neural networks dubbed ` ∞-dist Net . Denote z as the input vector to a neuron . A standard neuron processes the input by first projecting z to a scalar value using a linear transformation , and then applying an non-linear activation function σ on it , i.e. , σ ( w > z + b ) . w and b are parameters , and function σ can be the sigmoid or ReLU activation . Unlike the previous design paradigm , we introduce a new type of neuron using ` ∞ distance as the basic operation , which we call ` ∞-dist neuron : u ( z , θ ) = ‖z −w‖∞ + b , ( 2 ) where θ = { w , b } is the parameter set . From the above equation , we can see that the ` ∞-dist neuron is non-linear as it calculates the ` ∞ distance between input z and parameter w with a bias term b . As a result , there is no need to further apply a non-linear activation function . Without loss of generality , we study the properties of multi-layer perceptron ( MLP ) networks that are constructed using ` ∞-dist neurons . All theoretical results can be easily extended to other neural network architectures , such as convolutional neural nets . We use x ∈ Rdinput to denote the input vector of an MLP network . A ( MLP ) network using ` ∞-dist neurons can be formally defined as follows . Definition 3.1 . ( ` ∞-dist Net ) Denote g as an MLP network which takes x ( 1 ) , x ∈ Rdinput as input . Assume there are L hidden layers and the l-th hidden layer contains dl hidden units . We call g is an MLP network constructed by ` ∞-dist neurons , if the k-th unit in the l-th hidden layer x ( l+1 ) k is computed by x ( l+1 ) k = u ( x ( l ) , θ ( l , k ) ) = ‖x ( l ) −w ( l , k ) ‖∞ + b ( l , k ) , 0 < l ≤ L , 0 < k ≤ dl , where x ( l ) = ( x ( l ) 1 , x ( l ) 2 , · · · , x ( l ) dl−1 ) is the input vector to the l-th hidden layer . For simplicity , we will call an MLP network constructed by ` ∞-dist neurons as ` ∞-dist Net . For classification tasks , the dimensionality of the output of g matches the number of categories , i.e. , M . We write g ( x ) = ( g1 ( x ) , g2 ( x ) , · · · , gM ( x ) ) and define the predictor f ( x ) = arg maxi∈ [ M ] gi ( x ) . Note that g ( x ) can be used as the output logits the same as in any other networks , so we can apply any standard loss function on the ` ∞-dist Net , such as the cross-entropy loss or hinge loss . We will further show that the ` ∞-dist neuron and the neural networks constructed using it have nice theoretical properties to control the robustness of the model . For completeness , we first introduce the definition of Lipschitz functions as below . Definition 3.2 . ( Lipschitz Function ) A function g ( z ) : Rm → Rn is called λ-Lipschitz with respect to ` p norm ‖ · ‖p , if for any z1 , z2 , the following holds : ‖g ( z1 ) − g ( z2 ) ‖p ≤ λ‖z1 − z2‖p It is straightforward to see that the ` ∞-dist neuron is 1-Lipschitz with respect to ` ∞ norm .
The contribution of the paper is threefold: First, it proposes a novel variation of AdderNet (Chen et al. 2020) that ensures the network is always 1-Lipschitz with respect to $\ell_{\infty}$ norm. The architecture allows one to generate robustness certificates with respect to $\ell_{\infty}$ norm with only a single forward pass, which is computationally cheap compared to many of the previous methods. Second, it analyzes the expressive power and robust generalization of the architecture. Finally, it proposes two training techniques (bias batchnorm and p-norm schedule) that overcome the optimization problem inherent with training $\ell_{\infty}$ Net and analyzes its empirical performance with respect to the previous methods.
SP:a84853c2ccc676838a77ef3323d5eb60fb5b638b
Generalizing Tree Models for Improving Prediction Accuracy
1 INTRODUCTION . Can we generalize and improve the representation power of tree models ? The tree models learn a structure where the decision process is easy to follow ( Breiman et al. , 1984 ) . Due to this attractive feature of tree models , various efforts are being put to improve their performance or to utilize them as subcomponents of a deep learning model ( Kontschieder et al. , 2015 ; Shen et al. , 2018 ) . Compared to typical deep neural networks , the main characteristic of tree models is that input data are propagated through layers without a change in their representations ; the internal nodes calculate the probability of an input x arriving at the leaf nodes . The decision process that determines the membership of a training example , i.e. , the process of constructing the subsets of training data at each leaf , is the core operation in tree models , which we generalize and improve in this work . Previous works on tree models consider the decisions at different nodes as separate operations , i.e. , each node performs its own decision independently from the other nodes in the same layer , based on the arrival probability of an input x to the node . The independence of decisions allows learning to be simplified . However , in order to obtain a comprehensive view , the decisions of multiple nodes must be considered simultaneously . Furthermore , a typical tree model with a depth of L requires bL − 1 decision functions , where b is a branching factor , which makes it intractable to construct a deep tree model . In this work , we suggest that many tree models can be generalized to what we term as the decision transformer as Proposition 1 . A decision transformer generalizes existing tree models by treating the decisions of each layer as a single operation involving all nodes in that layer . More specifically , the decision transformer views each layer as a stochastic decision ( Def . 2 ) which linearly transforms the membership of each training data by a learned stochastic matrix ( Def . 1 ) . The aggregated layerwise view allows the decision transformer to reduce the complexity of analysis to O ( L ) , where L is the tree depth . Furthermore , formulating the tree models in a probabilistic context allows them to be understood by the deep learning framework and provides us a theoretical foundation for deeply understanding the advantages and the limitations of existing tree models in one framework . The in-depth understanding of tree models as decision transformers allows us to propose Decision Transformer Network ( DTN ) , a novel architecture that inherits the interpretability of tree models while improving their representation power . DTN is an extension of tree models into deep networks that creates multiple paths between nodes based on stochastic decisions . We propose two versions of DTN : DTN-D with full dense connections and DTN-S with sparse connections where the edges are connected in a locality-sensitive form . Our experiments show that DTN outperforms previous tree models and deep neural networks on 121 tabular datasets . Our contributions are summarized as follows . First , we introduce a generalized framework for tree models called the decision transformer and perform theoretical analysis on its generalizability and interpretability ( Section 3 ) . Second , we propose dense and sparse versions of Decision Transformer Network ( DTN ) , our novel decision-based model that is both interpretable and accurate ( Section 4 ) . Third , we undergo extensive experiments on 121 tabular datasets to show that DTN outperforms the state-of-the-art tree models and deep neural networks ( Section 5 ) . 2 RELATED WORKS . A tree model refers to a parameterized function that passes an example through its tree-structured layers without changing its representations . We categorize tree models based on whether it utilizes linear decisions over raw features or neural networks in combination with representation learning . Tree Models with Linear Decisions Traditional tree models perform linear decisions over a raw feature . Given an example x , decision trees ( DT ) ( Breiman et al. , 1984 ) compare a single selected element to a learned threshold at each branch to perform a decision . Soft decision trees ( SDT ) ( Irsoy et al. , 2012 ) generalize DTs to use all elements of x by a logistic classifier , making a probabilistic decision in each node . SDTs have been widely studied and applied to various problems due to its simplicity ( Irsoy & Alpaydin , 2015 ; Frosst & Hinton , 2017 ; Linero & Yang , 2018 ; Yoo & Sael , 2019 ) . Deep neural decision trees ( Yang et al. , 2018 ) also extend DTs to a multi-branched tree by splitting each feature element into multiple bins . These models provide a direct interpretation of predictions and decision processes . There are also well-known ensembles of such linear trees , such as random forests ( Breiman , 2001 ) and XGBoost ( Chen & Guestrin , 2016 ) . These ensemble models tboost the performance of tree models at the expense of interpretability . Tree Models with Representation Learning There are recent works combining tree models with deep neural networks , which add the ability of representation learning to the hierarchical decisions of tree models . A popular approach is to use abstract representations learned by convolutional neural networks ( CNNs ) as inputs of the decision functions of tree models ( Kontschieder et al. , 2015 ; Roy & Todorovic , 2016 ; Shen et al. , 2017 ; 2018 ; Wan et al. , 2020 ) , sometimes with multilayer perceptrons instead of CNNs ( Bulò & Kontschieder , 2014 ) . Another approach is to categorize raw examples by hierarchical decisions and then apply different classifiers to the separate clusters ( Murthy et al. , 2016 ) . There are also approaches that improve the performance of deep neural networks by inserting hierarchical decisions as differentiable operations into a neural network , instead of building a complete tree model ( Murdock et al. , 2016 ; McGill & Perona , 2017 ; Brust & Denzler , 2019 ; Tanno et al. , 2019 ) . In this work , we focus on models having complete trees in its structure . 3 GENERALIZING TREE MODELS . We first introduce a decision transformer , our unifying framework that represents a tree model as a series of linear transformations over probability vectors . We then analyze the properties of decision transformers : the generalizability to existing tree models and the interpretability . 3.1 DECISIONS TRANSFORMERS . Definition 1 ( Stochastic matrix ) . A matrix T is ( left ) stochastic if T ≥ 0 and ∑ i aij = 1 for all j . A vector p is stochastic if it satisfies the condition as a matrix of size |p| × 1 . We denote the set of all stochastic vectors and matrices as P , i.e. , we represent that T ∈ P or p ∈ P . Definition 2 ( Stochastic decision ) . A function f is a stochastic decision if it linearly transforms an input vector π by a left stochastic matrix as f ( π ) = Tπ , where T ∈ P is independent of π. Corollary 1 . Given a stochastic decision f and a vector π , f ( π ) ∈ P if π ∈ P . Based on the observation that each layer of a tree model can be represented as a stochastic decision that eventually learns the membership probability of an input x to the leaf nodes , we propose decision transformers which represent a tree model as a series of stochastic decisions whose transition matrices are determined by x . Proposition 1 ( Decision transformer ) . A parameterized classifierM is a decision transformer if it can be represented as M ( x ; Θ ) = FTL−1 · · ·T1T0π0 ∈ RC , ( 1 ) whereC is the number of target classes , π0 ∈ P is the initial decision probability , L is the number of decisions , Tl ∈ P is a transition matrix , and F ∈ P is a classifier matrix . Tl and F are calculated from parameterized functions Tl and F , respectively , that take x as inputs : Tl = Tl ( x ; θl ) ∈ RNl+1×Nl F = F ( x ; θL ) ∈ RC×NL , ( 2 ) whereNl is the size of decision vectors after the l-th transformation . The initial decision probability π0 is typically given as a hyperparameter , and thus Θ = { θ0 , · · · , θL } . We define Tl and F separately since internal and leaf nodes have different functionality in most tree models , although they are basically the same . For example , the lth internal layer of a typical decision tree updates a one-hot membership probability of x by a stochastic matrix Tl , which is generated by comparing an element of x to a learned threshold . In this case , Tl is a rectangular block-diagonal matrix having nonzero elements at ( 2j , j ) and ( 2j + 1 , j ) for every node j in the layer . On the other hand , the leaf layer utilizes a dense classification matrix F that makes the final prediction . Figure 1 illustrates two views of a binary tree model . Figure 1a treats a tree model as a set of independent decisions that are selected based on the path of x . On the other hand , Figure 1b represents the tree as a series of linear transformations , based on our framework of decision transformers . 3.2 GENERALIZING BINARY TREE MODELS . We now represent existing tree models as decision transformers and determine their characteristics . We work with binary trees for simplicity , but the analysis can be naturally extended to tree models having higher branching factors ( Yang et al. , 2018 ; Murthy et al. , 2016 ; Tanno et al. , 2019 ) . Binary tree models can be represented with block diagonal transition matrices with nonzero values on the 2 × 1 diagonal blocks , such that each column contains at most two nonzero elements that sum to one . Corollary 2 formalizes this notion . Corollary 2 . The l-th transition function Tl of a binary tree model is represented as Tl ( x ) = diag ( [ d1 ( x ) 1− d1 ( x ) ] , · · · , [ dn ( x ) 1− dn ( x ) ] ) ∈ R2 l+1×2l , ( 3 ) where diag ( · ) generates a rectangular block diagonal matrix , and di is the unit decision function of node i , which measures the probability of x for taking the left branch at node i . Based on Corollary 2 , we represent various tree models with specific forms of transition functions as summarized in Table 1 . The unit decision function of decision trees ( DT ) selects a single feature of x by a one-hot vector 1i and then compares it to a threshold bi considering a learnable sign si . Each leave returns a one-hot vector of length C as a prediction , where C is the number of classes . Soft decision trees ( SDT ) extend DTs by a ) producing a probabilistic decision utilizing all features of x at each internal node and b ) returning a soft categorical distribution at each leaf as a prediction . The decision functions of these two models are linear with respect to the raw feature x and thus the decision processes are naturally interpretable . Complex models that utilize deep neural networks for decision functions can also be generalized with the decision transformer . Neural decision forests ( NDF ) use a randomized multilayer perceptron ( MLP ) as a decision function . Deep neural decision forests ( DNDF ) use a shared convolutional neural network ( CNN ) for all decisions with changing only the last fully-connected layer . Neural regression forests ( NRF ) improve DNDFs by adopting a hierarchical CNN having different numbers of convolution operations based on the depth of node i in addition to the last fully-connected layer . Other models ( Shen et al. , 2017 ; 2018 ) that have an identical structure to DNDFs and NRFs .
The authors propose Decision Transformer Networks (DTNs): a model that generalizes decision trees to deep network style decision graphs. Structurally, DTNs are similar to deep neural networks with layers of nodes operating as stochastic decision functions and which output probabilities of an input vector belonging to each sub-network. The probabilistic predictions of the decision nodes in a layer are aggregated in a "transition matrix" and passed to the next layer until the leaf layer is reached where the final classification decision is made. The goal of DTNs is to improve the representation power of tree models by transforming (exponentially large) trees to compact graphs without losing its interpretability power. The authors propose special scoring functions to explain the decisions made by each layer as well as the model. On a diverse set of datasets ranging from small (<1K) to large (>10K), DTNs (dense and sparse) with softmax and spherical-softmax decision nodes, attained better accuracies than MLPs, conventional decision trees and their soft versions.
SP:023f656e324a7c753e79703a9e9ff7638990a11c
Generalizing Tree Models for Improving Prediction Accuracy
1 INTRODUCTION . Can we generalize and improve the representation power of tree models ? The tree models learn a structure where the decision process is easy to follow ( Breiman et al. , 1984 ) . Due to this attractive feature of tree models , various efforts are being put to improve their performance or to utilize them as subcomponents of a deep learning model ( Kontschieder et al. , 2015 ; Shen et al. , 2018 ) . Compared to typical deep neural networks , the main characteristic of tree models is that input data are propagated through layers without a change in their representations ; the internal nodes calculate the probability of an input x arriving at the leaf nodes . The decision process that determines the membership of a training example , i.e. , the process of constructing the subsets of training data at each leaf , is the core operation in tree models , which we generalize and improve in this work . Previous works on tree models consider the decisions at different nodes as separate operations , i.e. , each node performs its own decision independently from the other nodes in the same layer , based on the arrival probability of an input x to the node . The independence of decisions allows learning to be simplified . However , in order to obtain a comprehensive view , the decisions of multiple nodes must be considered simultaneously . Furthermore , a typical tree model with a depth of L requires bL − 1 decision functions , where b is a branching factor , which makes it intractable to construct a deep tree model . In this work , we suggest that many tree models can be generalized to what we term as the decision transformer as Proposition 1 . A decision transformer generalizes existing tree models by treating the decisions of each layer as a single operation involving all nodes in that layer . More specifically , the decision transformer views each layer as a stochastic decision ( Def . 2 ) which linearly transforms the membership of each training data by a learned stochastic matrix ( Def . 1 ) . The aggregated layerwise view allows the decision transformer to reduce the complexity of analysis to O ( L ) , where L is the tree depth . Furthermore , formulating the tree models in a probabilistic context allows them to be understood by the deep learning framework and provides us a theoretical foundation for deeply understanding the advantages and the limitations of existing tree models in one framework . The in-depth understanding of tree models as decision transformers allows us to propose Decision Transformer Network ( DTN ) , a novel architecture that inherits the interpretability of tree models while improving their representation power . DTN is an extension of tree models into deep networks that creates multiple paths between nodes based on stochastic decisions . We propose two versions of DTN : DTN-D with full dense connections and DTN-S with sparse connections where the edges are connected in a locality-sensitive form . Our experiments show that DTN outperforms previous tree models and deep neural networks on 121 tabular datasets . Our contributions are summarized as follows . First , we introduce a generalized framework for tree models called the decision transformer and perform theoretical analysis on its generalizability and interpretability ( Section 3 ) . Second , we propose dense and sparse versions of Decision Transformer Network ( DTN ) , our novel decision-based model that is both interpretable and accurate ( Section 4 ) . Third , we undergo extensive experiments on 121 tabular datasets to show that DTN outperforms the state-of-the-art tree models and deep neural networks ( Section 5 ) . 2 RELATED WORKS . A tree model refers to a parameterized function that passes an example through its tree-structured layers without changing its representations . We categorize tree models based on whether it utilizes linear decisions over raw features or neural networks in combination with representation learning . Tree Models with Linear Decisions Traditional tree models perform linear decisions over a raw feature . Given an example x , decision trees ( DT ) ( Breiman et al. , 1984 ) compare a single selected element to a learned threshold at each branch to perform a decision . Soft decision trees ( SDT ) ( Irsoy et al. , 2012 ) generalize DTs to use all elements of x by a logistic classifier , making a probabilistic decision in each node . SDTs have been widely studied and applied to various problems due to its simplicity ( Irsoy & Alpaydin , 2015 ; Frosst & Hinton , 2017 ; Linero & Yang , 2018 ; Yoo & Sael , 2019 ) . Deep neural decision trees ( Yang et al. , 2018 ) also extend DTs to a multi-branched tree by splitting each feature element into multiple bins . These models provide a direct interpretation of predictions and decision processes . There are also well-known ensembles of such linear trees , such as random forests ( Breiman , 2001 ) and XGBoost ( Chen & Guestrin , 2016 ) . These ensemble models tboost the performance of tree models at the expense of interpretability . Tree Models with Representation Learning There are recent works combining tree models with deep neural networks , which add the ability of representation learning to the hierarchical decisions of tree models . A popular approach is to use abstract representations learned by convolutional neural networks ( CNNs ) as inputs of the decision functions of tree models ( Kontschieder et al. , 2015 ; Roy & Todorovic , 2016 ; Shen et al. , 2017 ; 2018 ; Wan et al. , 2020 ) , sometimes with multilayer perceptrons instead of CNNs ( Bulò & Kontschieder , 2014 ) . Another approach is to categorize raw examples by hierarchical decisions and then apply different classifiers to the separate clusters ( Murthy et al. , 2016 ) . There are also approaches that improve the performance of deep neural networks by inserting hierarchical decisions as differentiable operations into a neural network , instead of building a complete tree model ( Murdock et al. , 2016 ; McGill & Perona , 2017 ; Brust & Denzler , 2019 ; Tanno et al. , 2019 ) . In this work , we focus on models having complete trees in its structure . 3 GENERALIZING TREE MODELS . We first introduce a decision transformer , our unifying framework that represents a tree model as a series of linear transformations over probability vectors . We then analyze the properties of decision transformers : the generalizability to existing tree models and the interpretability . 3.1 DECISIONS TRANSFORMERS . Definition 1 ( Stochastic matrix ) . A matrix T is ( left ) stochastic if T ≥ 0 and ∑ i aij = 1 for all j . A vector p is stochastic if it satisfies the condition as a matrix of size |p| × 1 . We denote the set of all stochastic vectors and matrices as P , i.e. , we represent that T ∈ P or p ∈ P . Definition 2 ( Stochastic decision ) . A function f is a stochastic decision if it linearly transforms an input vector π by a left stochastic matrix as f ( π ) = Tπ , where T ∈ P is independent of π. Corollary 1 . Given a stochastic decision f and a vector π , f ( π ) ∈ P if π ∈ P . Based on the observation that each layer of a tree model can be represented as a stochastic decision that eventually learns the membership probability of an input x to the leaf nodes , we propose decision transformers which represent a tree model as a series of stochastic decisions whose transition matrices are determined by x . Proposition 1 ( Decision transformer ) . A parameterized classifierM is a decision transformer if it can be represented as M ( x ; Θ ) = FTL−1 · · ·T1T0π0 ∈ RC , ( 1 ) whereC is the number of target classes , π0 ∈ P is the initial decision probability , L is the number of decisions , Tl ∈ P is a transition matrix , and F ∈ P is a classifier matrix . Tl and F are calculated from parameterized functions Tl and F , respectively , that take x as inputs : Tl = Tl ( x ; θl ) ∈ RNl+1×Nl F = F ( x ; θL ) ∈ RC×NL , ( 2 ) whereNl is the size of decision vectors after the l-th transformation . The initial decision probability π0 is typically given as a hyperparameter , and thus Θ = { θ0 , · · · , θL } . We define Tl and F separately since internal and leaf nodes have different functionality in most tree models , although they are basically the same . For example , the lth internal layer of a typical decision tree updates a one-hot membership probability of x by a stochastic matrix Tl , which is generated by comparing an element of x to a learned threshold . In this case , Tl is a rectangular block-diagonal matrix having nonzero elements at ( 2j , j ) and ( 2j + 1 , j ) for every node j in the layer . On the other hand , the leaf layer utilizes a dense classification matrix F that makes the final prediction . Figure 1 illustrates two views of a binary tree model . Figure 1a treats a tree model as a set of independent decisions that are selected based on the path of x . On the other hand , Figure 1b represents the tree as a series of linear transformations , based on our framework of decision transformers . 3.2 GENERALIZING BINARY TREE MODELS . We now represent existing tree models as decision transformers and determine their characteristics . We work with binary trees for simplicity , but the analysis can be naturally extended to tree models having higher branching factors ( Yang et al. , 2018 ; Murthy et al. , 2016 ; Tanno et al. , 2019 ) . Binary tree models can be represented with block diagonal transition matrices with nonzero values on the 2 × 1 diagonal blocks , such that each column contains at most two nonzero elements that sum to one . Corollary 2 formalizes this notion . Corollary 2 . The l-th transition function Tl of a binary tree model is represented as Tl ( x ) = diag ( [ d1 ( x ) 1− d1 ( x ) ] , · · · , [ dn ( x ) 1− dn ( x ) ] ) ∈ R2 l+1×2l , ( 3 ) where diag ( · ) generates a rectangular block diagonal matrix , and di is the unit decision function of node i , which measures the probability of x for taking the left branch at node i . Based on Corollary 2 , we represent various tree models with specific forms of transition functions as summarized in Table 1 . The unit decision function of decision trees ( DT ) selects a single feature of x by a one-hot vector 1i and then compares it to a threshold bi considering a learnable sign si . Each leave returns a one-hot vector of length C as a prediction , where C is the number of classes . Soft decision trees ( SDT ) extend DTs by a ) producing a probabilistic decision utilizing all features of x at each internal node and b ) returning a soft categorical distribution at each leaf as a prediction . The decision functions of these two models are linear with respect to the raw feature x and thus the decision processes are naturally interpretable . Complex models that utilize deep neural networks for decision functions can also be generalized with the decision transformer . Neural decision forests ( NDF ) use a randomized multilayer perceptron ( MLP ) as a decision function . Deep neural decision forests ( DNDF ) use a shared convolutional neural network ( CNN ) for all decisions with changing only the last fully-connected layer . Neural regression forests ( NRF ) improve DNDFs by adopting a hierarchical CNN having different numbers of convolution operations based on the depth of node i in addition to the last fully-connected layer . Other models ( Shen et al. , 2017 ; 2018 ) that have an identical structure to DNDFs and NRFs .
The authors propose a new model that consists in transforming decision trees by seeing such models as a sequence of "layers" made of all nodes at the same tree depth. Each layer is then modelled as a stochastic decision (multiplication by a stochastic matrix) which can mimic the behaviour of both standard decision tree and stochastic trees (among others). Their idea is to keep the layer decomposition as it is to be able to understand/interpret each layer as pieces of the bigger picture (i.e., the interpretation of the model itself).
SP:023f656e324a7c753e79703a9e9ff7638990a11c
Representational aspects of depth and conditioning in normalizing flows
1 INTRODUCTION . Deep generative models are one of the lynchpins of unsupervised learning , underlying tasks spanning distribution learning , feature extraction and transfer learning . Parametric families of neural-network based models have been improved to the point of being able to model complex distributions like images of human faces . One paradigm that has received a lot attention is normalizing flows , which model distributions as pushforwards of a standard Gaussian ( or other simple distribution ) through an invertible neural network G. Thus , the likelihood has an explicit form via the change of variables formula using the Jacobian of G. Training normalizing flows is challenging due to a couple of main issues . Empirically , these models seem to require a much larger size than other generative models ( e.g . GANs ) and most notably , a much larger depth . This makes training challenging due to vanishing/exploding gradients . A very related problem is conditioning , more precisely the smallest singular value of the forward map G. It ’ s intuitively clear that natural images will have a low-dimensional structure , thus a close-to-singular G might be needed . On the other hand , the change-of-variables formula involves the determinant of the Jacobian of G−1 , which grows larger the more singular G is . While recently , the universal approximation power of various types of invertible architectures has been studied ( Dupont et al. , 2019 ; Huang et al. , 2020 ) if the input is padded with a sufficiently large number of all-0 coordinates , precise quantification of the cost of invertibility in terms of the depth required and the conditioning of the model has not been fleshed out . In this paper , we study both mathematically and empirically representational aspects of depth and conditioning in normalizing flows and answer several fundamental questions . 2 OVERVIEW OF RESULTS . 2.1 RESULTS ABOUT GENERAL ARCHITECTURES . In order to guarantee that the network is invertible , normalizing flow models place significant restrictions on the architecture of the model . The most basic question we can ask is how this restriction affects the expressive power of the model — in particular , how much the depth must increase to compensate . More precisely , we ask : Question 1 : is there a distribution over Rd which can be written as the pushforward of a Gaussian through a small , shallow generator , which can not be approximated by the pushforward of a Gaussian through a small , shallow layerwise invertible neural network ? Given that there is great latitude in terms of the choice of layer architecture , while keeping the network invertible , the most general way to pose this question is to require each layer to be a function of p parameters – i.e . f = f1◦f2◦· · ·◦f ` where ◦ denotes function composition and each fi : Rd → Rd is an invertible function specified by a vector θi ∈ Rp of parameters . This framing is extremely general : for instance it includes layerwise invertible feedforward networks in which fi ( x ) = σ⊗d ( Aix+ bi ) , σ is invertible , Ai ∈ Rd×d is invertible , θi = ( Ai , bi ) and p = d ( d + 1 ) . It also includes popular architectures based on affine coupling blocks ( e.g . Dinh et al . ( 2014 ; 2016 ) ; Kingma & Dhariwal ( 2018 ) ) where each fi has the form fi ( xSi , x [ d ] \Si ) = ( xSi , x [ d ] \Si gi ( xSi ) + hi ( xSi ) ) for some S ⊂ [ d ] which we revisit in more detail in the following subsection . We answer this question in the affirmative : namely , we show for any k that there is a distribution over Rd which can be expressed as the pushforward of a network with depth O ( 1 ) and size O ( k ) that can not be ( even very approximately ) expressed as the pushforward of a Gaussian through a Lipschitz layerwise invertible network of depth smaller than k/p . Towards formally stating the result , let θ = ( θ1 , . . . , θ ` ) ∈ Θ ⊂ Rd ′ be the vector of all parameters ( e.g . weights , biases ) in the network , where θi ∈ Rp are the parameters that correspond to layer i , and let fθ : Rd → Rd denote the resulting function . Define R so that Θ is contained in the Euclidean ball of radius R. We say the family fθ is L-Lipschitz with respect to its parameters and inputs , if ∀θ , θ′ ∈ Θ : Ex∼N ( 0 , Id×d ) ‖fθ ( x ) − fθ′ ( x ) ‖ ≤ L‖θ − θ ′‖ and ∀x , y ∈ Rd , ‖fθ ( x ) − fθ ( y ) ‖ ≤ L‖x− y‖ . 1 We will discuss the reasonable range for L in terms of the weights after the Theorem statement . We show2 : Theorem 1 . For any k = exp ( o ( d ) ) , L = exp ( o ( d ) ) , R = exp ( o ( d ) ) , we have that for d sufficiently large and any γ > 0 there exists a neural network g : Rd+1 → Rd with O ( k ) parameters and depth O ( 1 ) , s.t . for any family { fθ , θ ∈ Θ } of layerwise invertible networks that are L-Lipschitz with respect to its parameters and inputs , have p parameters per layer and depth at most k/p we have ∀θ ∈ Θ , W1 ( ( fθ ) # N , g # N ) ≥ 10γ2d Furthermore , for all θ ∈ Θ , KL ( ( fθ ) # N , g # N ) ≥ 1/10 and KL ( g # N , ( fθ ) # N ) ≥ 10γ 2d L2 . Remark 1 : First , note that while the number of parameters in both networks is comparable ( i.e . it ’ s O ( k ) ) , the invertible network is deeper , which usually is accompanied with algorithmic difficulties for training , due to vanishing and exploding gradients . For layerwise invertible generators , if we assume that the nonlinearity σ is 1-Lipschitz and each matrix in the network has operator norm at most M , 1Note for architectures having trainable biases in the input layer , these two notions of Lipschitzness should be expected to behave similarly . 2In this Theorem and throughout , we use the standard asymptotic notation f ( d ) = o ( g ( d ) ) to indicate that lim supd→∞ f ( d ) g ( d ) = 0 . For example , the assumption k , L , R = exp ( o ( d ) ) means that for any sequence ( kd , Ld , Rd ) ∞ d=1 such that lim supd→∞ max ( log kd , logLd , logRd ) d = 0 the result holds true . then a depth ` network will have L = O ( M ` ) 3 and p = O ( d2 ) . For an affine coupling network with g , h parameterized by H-layer networks with p/2 parameters each , 1-Lipschitz activations and weights bounded by M as above , we would similarly have L = O ( M ` H ) . Remark 2 : We make a couple of comments on the “ hard ” distribution g we construct , as well as the meaning of the parameter γ and how to interpret the various lower bounds in the different metrics . The distribution g for a given γ will in fact be close to a mixture of k Gaussians , each with mean on the sphere of radius 10γ2d and covariance matrix γ2Id . Thus this distribution has most of it ’ s mass in a sphere of radius O ( γ2d ) — so the Wasserstein guarantee gives close to a trivial approximation for g. The KL divergence bounds are derived by so-called transport inequalities between KL and Wasserstein for subgaussian distributions Bobkov & Götze ( 1999 ) . The discrepancy between the two KL divergences comes from the fact that the functions g , fθ may have different Lipschitz constants , hence the tails of g # N and f # N behave differently . In fact , if the function fθ had the same Lipschitz constant as g , both KL lower bounds would be on the order of a constant . 2.2 RESULTS ABOUT AFFINE COUPLING ARCHITECTURES . Next , we prove several results for a particularly common normalizing flow architectures : those based on affine coupling layers ( Dinh et al. , 2014 ; 2016 ; Kingma & Dhariwal , 2018 ) . The appeal of these architecture comes from training efficiency . Although layerwise invertible neural networks ( i.e . networks for which each layer consists of an invertible matrix and invertible pointwise nonlinearity ) seem like a natural choice , in practice these models have several disadvantages : for example , computing the determinant of the Jacobian is expensive unless the weight matrices are restricted . Consequently , it ’ s typical for the transformations in a flow network to be constrained in a manner that allows for efficient computation of the Jacobian determinant . The most common building block is an affine coupling block , originally proposed by Dinh et al . ( 2014 ; 2016 ) . A coupling block partitions the coordinates [ d ] into two parts : S and [ d ] \ S , for a subset S with |S| containing around half the coordinates of d. The transformation then has the form : Definition 1 . An affine coupling block is a map f : Rd → Rd , s.t . f ( xS , x [ d ] \S ) = ( xS , x [ d ] \S s ( xS ) + t ( xS ) ) Of course , the modeling power will be severely constrained if the coordinates in S never change : so typically , flow models either change the set S in a fixed or learned way ( e.g . alternating between different partitions of the channel in Dinh et al . ( 2016 ) or applying a learned permutation in Kingma & Dhariwal ( 2018 ) ) . Of course , a permutation is a discrete object , so difficult to learn in a differentiable manner – so Kingma & Dhariwal ( 2018 ) simply learns an invertible linear function ( i.e . a 1x1 convolution ) as a differentiation-friendly relaxation thereof . 2.2.1 THE EFFECT OF CHOICE OF PARTITION ON DEPTH . The first question about affine couplings we ask is how much of a saving in terms of the depth of the network can one hope to gain from using learned partitions ( ala GLOW ) as compared to a fixed partition . More precisely : Question 2 : Can models like Glow ( Kingma & Dhariwal , 2018 ) be simulated by a sequence of affine blocks with a fixed partition without increasing the depth by much ? We answer this question in the affirmative at least for equally sized partitions ( which is what is typically used in practice ) . We show the following surprising fact : consider an arbitrary partition ( S , [ 2d ] \ S ) of [ 2d ] , such that S satisfies |S| = d , for d ∈ N. Then for any invertible matrix T ∈ R2d×2d , the linear map T : R2d → R2d can be exactly represented by a composition of O ( 1 ) affine coupling layers that are linear , namely have the formLi ( xS , x [ 2d ] \S ) = ( xS , Bix [ 2d ] \S+AixS ) or Li ( xS , x [ 2d ] \S ) = ( CixS + Dix [ 2d ] \S , x [ 2d ] \S ) for matrices Ai , Bi , Ci , Di ∈ Rd×d , s.t . each Bi , Ci is diagonal . For convenience of notation , without loss of generality let S = [ d ] . Then , each of the layers Li is a matrix of the form [ I 0 Ai Bi ] or [ Ci Di 0 I ] , where the rows and columns are partitioned into blocks of size d. With this notation in place , we show the following theorem : 3Note , our theorem applies to exponentially large Lipschitz constants . Theorem 2 . For all d ≥ 4 , there exists a k ≤ 24 such that for any invertible T ∈ R2d×2d with det ( T ) > 0 , there exist matrices Ai , Di ∈ Rd×d and diagonal matrices Bi , Ci ∈ Rd×d≥0 for all i ∈ [ k ] such that T = k∏ i=1 [ I 0 Ai Bi ] [ Ci Di 0 I ] Note that the condition det ( T ) > 0 is required , since affine coupling networks are always orientationpreserving . Adding one diagonal layer with negative signs suffices to model general matrices . In particular , since permutation matrices are invertible , this means that any applications of permutations to achieve a different partition of the inputs ( e.g . like in Glow ( Kingma & Dhariwal , 2018 ) ) can in principle be represented as a composition of not-too-many affine coupling layers , indicating that the flexibility in the choice of partition is not the representational bottleneck . It ’ s a reasonable to ask how optimal the k ≤ 24 bound is – we supplement our upper bound with a lower bound , namely that k ≥ 3 . This is surprising , as naive parameter counting would suggest k = 2 might work . Namely , we show : Theorem 3 . For all d ≥ 4 and k ≤ 2 , there exists an invertible T ∈ R2d×2d with det ( T ) > 0 , s.t . for all Ai , Di ∈ Rd×d and for all diagonal matrices Bi , Ci ∈ Rd×d≥0 , i ∈ [ k ] it holds that T 6= k∏ i=1 [ I 0 Ai Bi ] [ Ci Di 0 I ] Beyond the relevance of this result in the context of how important the choice of partitions is , it also shows a lower bound on the depth for an equal number of nonlinear affine coupling layers ( even with quite complex functions s and t in each layer ) – since a nonlinear network can always be linearized about a ( smooth ) point to give a linear network with the same number of layers . In other words , studying linear affine coupling networks lets us prove a depth lower bound/depth separation for nonlinear networks for free . Finally , in Section 5.3 , we include an empirical investigation of our theoretical results on synthetic data , by fitting random linear functions of varying dimensionality with linear affine networks of varying depths in order to see the required number of layers . The results there suggest that the constant in the upper bound is quite loose – and the correct value for k is likely closer to the lower bound – at least for random matrices .
The normalizing flows (NF) are among popular generative models, as they have the capability of converting a simple base distribution to complex distributions by successively applying change of variable formula. More importantly, NFs let us do inference by maximizing exact likelihood functions instead of other approximate functions like ELBO in VAEs. NFs have the invertibility constraints which make the calculations of their Jacobean determinants computationally prohibitive and require some tricks that make them easier to compute. All these tricks, among them affine coupling layers are of great popularity, come at the price of losing expressiveness. Therefore, we might need more layers (deep) to compensate for that. However, we lack a theoretical understanding of how much deep is enough to guarantee best results.
SP:1d9409b7e7670ef4b1083ebf80e9d2d83259467b
Representational aspects of depth and conditioning in normalizing flows
1 INTRODUCTION . Deep generative models are one of the lynchpins of unsupervised learning , underlying tasks spanning distribution learning , feature extraction and transfer learning . Parametric families of neural-network based models have been improved to the point of being able to model complex distributions like images of human faces . One paradigm that has received a lot attention is normalizing flows , which model distributions as pushforwards of a standard Gaussian ( or other simple distribution ) through an invertible neural network G. Thus , the likelihood has an explicit form via the change of variables formula using the Jacobian of G. Training normalizing flows is challenging due to a couple of main issues . Empirically , these models seem to require a much larger size than other generative models ( e.g . GANs ) and most notably , a much larger depth . This makes training challenging due to vanishing/exploding gradients . A very related problem is conditioning , more precisely the smallest singular value of the forward map G. It ’ s intuitively clear that natural images will have a low-dimensional structure , thus a close-to-singular G might be needed . On the other hand , the change-of-variables formula involves the determinant of the Jacobian of G−1 , which grows larger the more singular G is . While recently , the universal approximation power of various types of invertible architectures has been studied ( Dupont et al. , 2019 ; Huang et al. , 2020 ) if the input is padded with a sufficiently large number of all-0 coordinates , precise quantification of the cost of invertibility in terms of the depth required and the conditioning of the model has not been fleshed out . In this paper , we study both mathematically and empirically representational aspects of depth and conditioning in normalizing flows and answer several fundamental questions . 2 OVERVIEW OF RESULTS . 2.1 RESULTS ABOUT GENERAL ARCHITECTURES . In order to guarantee that the network is invertible , normalizing flow models place significant restrictions on the architecture of the model . The most basic question we can ask is how this restriction affects the expressive power of the model — in particular , how much the depth must increase to compensate . More precisely , we ask : Question 1 : is there a distribution over Rd which can be written as the pushforward of a Gaussian through a small , shallow generator , which can not be approximated by the pushforward of a Gaussian through a small , shallow layerwise invertible neural network ? Given that there is great latitude in terms of the choice of layer architecture , while keeping the network invertible , the most general way to pose this question is to require each layer to be a function of p parameters – i.e . f = f1◦f2◦· · ·◦f ` where ◦ denotes function composition and each fi : Rd → Rd is an invertible function specified by a vector θi ∈ Rp of parameters . This framing is extremely general : for instance it includes layerwise invertible feedforward networks in which fi ( x ) = σ⊗d ( Aix+ bi ) , σ is invertible , Ai ∈ Rd×d is invertible , θi = ( Ai , bi ) and p = d ( d + 1 ) . It also includes popular architectures based on affine coupling blocks ( e.g . Dinh et al . ( 2014 ; 2016 ) ; Kingma & Dhariwal ( 2018 ) ) where each fi has the form fi ( xSi , x [ d ] \Si ) = ( xSi , x [ d ] \Si gi ( xSi ) + hi ( xSi ) ) for some S ⊂ [ d ] which we revisit in more detail in the following subsection . We answer this question in the affirmative : namely , we show for any k that there is a distribution over Rd which can be expressed as the pushforward of a network with depth O ( 1 ) and size O ( k ) that can not be ( even very approximately ) expressed as the pushforward of a Gaussian through a Lipschitz layerwise invertible network of depth smaller than k/p . Towards formally stating the result , let θ = ( θ1 , . . . , θ ` ) ∈ Θ ⊂ Rd ′ be the vector of all parameters ( e.g . weights , biases ) in the network , where θi ∈ Rp are the parameters that correspond to layer i , and let fθ : Rd → Rd denote the resulting function . Define R so that Θ is contained in the Euclidean ball of radius R. We say the family fθ is L-Lipschitz with respect to its parameters and inputs , if ∀θ , θ′ ∈ Θ : Ex∼N ( 0 , Id×d ) ‖fθ ( x ) − fθ′ ( x ) ‖ ≤ L‖θ − θ ′‖ and ∀x , y ∈ Rd , ‖fθ ( x ) − fθ ( y ) ‖ ≤ L‖x− y‖ . 1 We will discuss the reasonable range for L in terms of the weights after the Theorem statement . We show2 : Theorem 1 . For any k = exp ( o ( d ) ) , L = exp ( o ( d ) ) , R = exp ( o ( d ) ) , we have that for d sufficiently large and any γ > 0 there exists a neural network g : Rd+1 → Rd with O ( k ) parameters and depth O ( 1 ) , s.t . for any family { fθ , θ ∈ Θ } of layerwise invertible networks that are L-Lipschitz with respect to its parameters and inputs , have p parameters per layer and depth at most k/p we have ∀θ ∈ Θ , W1 ( ( fθ ) # N , g # N ) ≥ 10γ2d Furthermore , for all θ ∈ Θ , KL ( ( fθ ) # N , g # N ) ≥ 1/10 and KL ( g # N , ( fθ ) # N ) ≥ 10γ 2d L2 . Remark 1 : First , note that while the number of parameters in both networks is comparable ( i.e . it ’ s O ( k ) ) , the invertible network is deeper , which usually is accompanied with algorithmic difficulties for training , due to vanishing and exploding gradients . For layerwise invertible generators , if we assume that the nonlinearity σ is 1-Lipschitz and each matrix in the network has operator norm at most M , 1Note for architectures having trainable biases in the input layer , these two notions of Lipschitzness should be expected to behave similarly . 2In this Theorem and throughout , we use the standard asymptotic notation f ( d ) = o ( g ( d ) ) to indicate that lim supd→∞ f ( d ) g ( d ) = 0 . For example , the assumption k , L , R = exp ( o ( d ) ) means that for any sequence ( kd , Ld , Rd ) ∞ d=1 such that lim supd→∞ max ( log kd , logLd , logRd ) d = 0 the result holds true . then a depth ` network will have L = O ( M ` ) 3 and p = O ( d2 ) . For an affine coupling network with g , h parameterized by H-layer networks with p/2 parameters each , 1-Lipschitz activations and weights bounded by M as above , we would similarly have L = O ( M ` H ) . Remark 2 : We make a couple of comments on the “ hard ” distribution g we construct , as well as the meaning of the parameter γ and how to interpret the various lower bounds in the different metrics . The distribution g for a given γ will in fact be close to a mixture of k Gaussians , each with mean on the sphere of radius 10γ2d and covariance matrix γ2Id . Thus this distribution has most of it ’ s mass in a sphere of radius O ( γ2d ) — so the Wasserstein guarantee gives close to a trivial approximation for g. The KL divergence bounds are derived by so-called transport inequalities between KL and Wasserstein for subgaussian distributions Bobkov & Götze ( 1999 ) . The discrepancy between the two KL divergences comes from the fact that the functions g , fθ may have different Lipschitz constants , hence the tails of g # N and f # N behave differently . In fact , if the function fθ had the same Lipschitz constant as g , both KL lower bounds would be on the order of a constant . 2.2 RESULTS ABOUT AFFINE COUPLING ARCHITECTURES . Next , we prove several results for a particularly common normalizing flow architectures : those based on affine coupling layers ( Dinh et al. , 2014 ; 2016 ; Kingma & Dhariwal , 2018 ) . The appeal of these architecture comes from training efficiency . Although layerwise invertible neural networks ( i.e . networks for which each layer consists of an invertible matrix and invertible pointwise nonlinearity ) seem like a natural choice , in practice these models have several disadvantages : for example , computing the determinant of the Jacobian is expensive unless the weight matrices are restricted . Consequently , it ’ s typical for the transformations in a flow network to be constrained in a manner that allows for efficient computation of the Jacobian determinant . The most common building block is an affine coupling block , originally proposed by Dinh et al . ( 2014 ; 2016 ) . A coupling block partitions the coordinates [ d ] into two parts : S and [ d ] \ S , for a subset S with |S| containing around half the coordinates of d. The transformation then has the form : Definition 1 . An affine coupling block is a map f : Rd → Rd , s.t . f ( xS , x [ d ] \S ) = ( xS , x [ d ] \S s ( xS ) + t ( xS ) ) Of course , the modeling power will be severely constrained if the coordinates in S never change : so typically , flow models either change the set S in a fixed or learned way ( e.g . alternating between different partitions of the channel in Dinh et al . ( 2016 ) or applying a learned permutation in Kingma & Dhariwal ( 2018 ) ) . Of course , a permutation is a discrete object , so difficult to learn in a differentiable manner – so Kingma & Dhariwal ( 2018 ) simply learns an invertible linear function ( i.e . a 1x1 convolution ) as a differentiation-friendly relaxation thereof . 2.2.1 THE EFFECT OF CHOICE OF PARTITION ON DEPTH . The first question about affine couplings we ask is how much of a saving in terms of the depth of the network can one hope to gain from using learned partitions ( ala GLOW ) as compared to a fixed partition . More precisely : Question 2 : Can models like Glow ( Kingma & Dhariwal , 2018 ) be simulated by a sequence of affine blocks with a fixed partition without increasing the depth by much ? We answer this question in the affirmative at least for equally sized partitions ( which is what is typically used in practice ) . We show the following surprising fact : consider an arbitrary partition ( S , [ 2d ] \ S ) of [ 2d ] , such that S satisfies |S| = d , for d ∈ N. Then for any invertible matrix T ∈ R2d×2d , the linear map T : R2d → R2d can be exactly represented by a composition of O ( 1 ) affine coupling layers that are linear , namely have the formLi ( xS , x [ 2d ] \S ) = ( xS , Bix [ 2d ] \S+AixS ) or Li ( xS , x [ 2d ] \S ) = ( CixS + Dix [ 2d ] \S , x [ 2d ] \S ) for matrices Ai , Bi , Ci , Di ∈ Rd×d , s.t . each Bi , Ci is diagonal . For convenience of notation , without loss of generality let S = [ d ] . Then , each of the layers Li is a matrix of the form [ I 0 Ai Bi ] or [ Ci Di 0 I ] , where the rows and columns are partitioned into blocks of size d. With this notation in place , we show the following theorem : 3Note , our theorem applies to exponentially large Lipschitz constants . Theorem 2 . For all d ≥ 4 , there exists a k ≤ 24 such that for any invertible T ∈ R2d×2d with det ( T ) > 0 , there exist matrices Ai , Di ∈ Rd×d and diagonal matrices Bi , Ci ∈ Rd×d≥0 for all i ∈ [ k ] such that T = k∏ i=1 [ I 0 Ai Bi ] [ Ci Di 0 I ] Note that the condition det ( T ) > 0 is required , since affine coupling networks are always orientationpreserving . Adding one diagonal layer with negative signs suffices to model general matrices . In particular , since permutation matrices are invertible , this means that any applications of permutations to achieve a different partition of the inputs ( e.g . like in Glow ( Kingma & Dhariwal , 2018 ) ) can in principle be represented as a composition of not-too-many affine coupling layers , indicating that the flexibility in the choice of partition is not the representational bottleneck . It ’ s a reasonable to ask how optimal the k ≤ 24 bound is – we supplement our upper bound with a lower bound , namely that k ≥ 3 . This is surprising , as naive parameter counting would suggest k = 2 might work . Namely , we show : Theorem 3 . For all d ≥ 4 and k ≤ 2 , there exists an invertible T ∈ R2d×2d with det ( T ) > 0 , s.t . for all Ai , Di ∈ Rd×d and for all diagonal matrices Bi , Ci ∈ Rd×d≥0 , i ∈ [ k ] it holds that T 6= k∏ i=1 [ I 0 Ai Bi ] [ Ci Di 0 I ] Beyond the relevance of this result in the context of how important the choice of partitions is , it also shows a lower bound on the depth for an equal number of nonlinear affine coupling layers ( even with quite complex functions s and t in each layer ) – since a nonlinear network can always be linearized about a ( smooth ) point to give a linear network with the same number of layers . In other words , studying linear affine coupling networks lets us prove a depth lower bound/depth separation for nonlinear networks for free . Finally , in Section 5.3 , we include an empirical investigation of our theoretical results on synthetic data , by fitting random linear functions of varying dimensionality with linear affine networks of varying depths in order to see the required number of layers . The results there suggest that the constant in the upper bound is quite loose – and the correct value for k is likely closer to the lower bound – at least for random matrices .
The paper gives very thorough mathematical representation for two challenges related to normalization flows, namely model’s large depth and conditioning which relates to the smallest singular value of the forward map. Topic is presented in a very orderly and comprehensive manner. All variables and concepts are explained and presentation is clear. Text and appendices give proofs for everything that has been discussed and appendices extensive presentation of experiments.
SP:1d9409b7e7670ef4b1083ebf80e9d2d83259467b
Enhancing Visual Representations for Efficient Object Recognition during Online Distillation
1 INTRODUCTION . Deep CNNs that are widely used for image classification ( Huang et al . ( 2017 ) ) often require large computing resources and process each image with high computational complexity ( Livni et al . ( 2014 ) ) . In real-world scenarios , the prior probability of occurrence of individual classes in an image stream is often unknown and varies with the deployed environment . For example , in a zoo , the image stream input to the deep CNN will mostly consist of animals , while that of vehicles would be rare . Other object classes such as furniture and aircraft would be absent . Therefore , only a subset of the many classes known to a deep CNN may be presented to it for classification during its deployment . To adapt to the varying prior class probability in the deployed scenario with high efficiency , we propose an online distillation framework - ENVISE . Here , we employ a high capacity general purpose image classifier as the teacher network ( TN ) , while the student network ( SN ) is a low capacity network . For greater efficiency and faster convergence , we require the coefficients of the SN to be binary and refer to it as the binary student network ( BSN ) . When the BSN is first deployed , it is trained on the unlabeled image stream using the predicted labels of the TN as pseudo-labels . Once the BSN converges to the performance of the TN , it is used as the primary classifier to rapidly classify the frequent classes faster than the TN . However , if a rare class appears ( i.e . a class absent during online training ) in the image stream , the BSN must accurately detect it as a class it has not yet encountered , which is then processed by the TN . Since the BSN is trained only on the frequent classes , we refer to these classes as inlier ( IL ) and the rare classes as outlier ( OL ) . It is important to note , that the OL classes are outliers with respect to the BSN only , but are known to the TN . Detecting extremely rare classes which are unknown to both the BSN and TN ( global unknowns ) is beyond the scope of this paper . Thus , assuming that the TN knows all possible classes from the deployed environment , we aim to increase the overall efficiency of the system ( without sacrificing performance ) by exploiting the higher probability of occurrence of frequent classes in a given scenario . Our approach for detecting OL classes is motivated from the observation by Ren et al . ( 2019 ) , where networks incorrectly learn to emphasize the background rather than the semantically important regions of the image leading to poor understanding of the IL classes . We know that attention maps highlight the regions of the image responsible for the classifier ’ s prediction ( Selvaraju et al . ( 2017 ) ) . We empirically observe that , the attention map of the BSN may focus on the background even when the attention map of the TN emphasizes the semantically meaningful regions of the image . In doing so , the BSN memorizes the labels of the TN , making it difficult to differentiate between the representations of IL and OL classes . To mitigate these issues , we propose an attention triplet loss that achieves two key objectives - a ) guide the attention map of the correct prediction of the BSN to focus on the semantically meaningful regions , and b ) simultaneously ensure that the attention map from the correct and incorrect predictions of the BSN are dissimilar . We show that by focusing on the semantically relevant regions of the image , the BSN will learn to distinguish between the representations of IL and OL classes , thereby improving its ability to detect OL classes . To assess the overall gain in efficiency of ENVISE , we propose a new evaluation metric - GiE , based on the number of times the BSN and TN are used to process the image stream . Since the deployed scene is comprised mostly of IL classes with few OL classes , we expect the BSN to be employed most of the time for classifying IL classes . The TN is used rarely i.e . only when the BSN detects an OL class . We refer to efficiency as the overall reduction in FLOPs in the online distillation framework to process the varying prior probability of classes in the image stream . This term differs from conventional model compression techniques ( Frankle & Carbin ( 2019 ) ; Chen et al . ( 2020 ) ) which process the image stream comprising of classes with equal probability using a single compressed model . To the best of our knowledge , we are the first to propose supervision on attention maps for OL detection , and a new evaluation metric that measures the gain in computational efficiency of an online distillation framework . A summary of our main contributions is : • Faster convergence of BSN : We theoretically justify and empirically illustrate that the BSN adapts to the performance of the TN faster than the real-valued SN ( RvSN ) . We also demonstrate the faster convergence of the BSN for different BSN architectures over its corresponding RvSN . • Attention triplet loss ( Lat ) , which guides the BSN to focus on the semantically meaningful regions of the image , thereby improving OL detection . • New evaluation metric - GiE to measure the overall gain in computational efficiency of the online distillation framework , and • We benchmark CIFAR-100 and tiny-imagenet datasets with SOTA OL detection meth- ods by creating meaningful IL and OL class pairs . ENVISE outperforms these baseline methods for OL detection , improves separation of IL and OL classes in the feature space , and yields the highest gain in computational efficiency . 2 RELATED WORK . Online distillation : Distilling knowledge to train a low-capacity student network from a highcapacity teacher network has been proposed as part of model compression ( Hinton et al . ( 2015 ) ) . Wang & Yoon ( 2020 ) provide a detailed review of different knowledge distillation methods . Mullapudi et al . ( 2019 ) propose an online distillation framework for semantic segmentation in videos , while Abolghasemi et al . ( 2019 ) use knowledge distillation to augment a visuomotor policy from visual attention . Lin et al . ( 2019 ) propose an ensemble student network that recursively learns from the teacher network in closed loop manner while Kim et al . ( 2019 ) use a feature fusion module to distill knowledge . Gao et al . ( 2019 ) propose online mutual learning and Cioppa et al . ( 2019 ) propose to periodically update weights to train an ensemble of student networks . These ensemble based methods require large computational resources and are expensive to train . However , ENVISE involves training a compact model that mimics the performance of the TN with less computation . Outlier detection : Outlier detection or out-of-distribution detection ( OOD ) refers to detecting a sample from an unknown class ( Hendrycks & Gimpel ( 2016 ) ) . Existing SOTA OOD methods use outlier samples during training or validation . Yu & Aizawa ( 2019 ) increase the distance between IL and OL samples during training while Vyas et al . ( 2018 ) ; Lee et al . ( 2018 ) add perturbations onto test images and train their network to differentiate between IL and OL samples . However in ENVISE , the BSN is adaptively trained only on IL class images without any knowledge of OL class images , which is a more realistic scenario . Without using outlier classes during training , Hendrycks & Gimpel ( 2016 ) ; Papadopoulos et al . ( 2019 ) ; Bendale & Boult ( 2016 ) ; Hendrycks et al . ( 2019 ) employ class probabilities or measure the similarity between IL and OL features . Yoshihashi et al . ( 2019 ) generate discriminative feature space using reconstruction based approaches . However , the likelihood of correct classification by these networks is based on background regions as described in Ren et al . ( 2019 ) . Hence , these methods fail when applied to real-world IL and OL class pairs since the confidence of prediction is based on background information . We overcome this drawback by proposing supervision on attention maps where we guide the BSN to focus on the important semantic regions using the attention map of the teacher network as a reference . This enables ENVISE to classify IL images with high confidence while also improving OL detection . 3 ONLINE DISTILLATION FOR EFFICIENT OBJECT RECOGNITION . The framework of ENVISE is shown in Figure 1 ( a ) . Initially , the TN ( indicated by “ 1 ” in the figure ) classifies the images from the input stream with high accuracy , albeit at a slower rate . The BSN ( red dotted box ) comprises of an adaptation module ( “ 2 ” ) and a binary CNN ( “ 3 ” ) . Given an image stream , the adaptation module learns the optimum binary weights to mimic the performance of the TN . Once its accuracy converges to that of the TN , the adaption of the real-valued weights stops , but the inference with binary weights continues . The OL detector ( “ 4 ” ) uses the softmax output of the BSN as confidence to either generate the final prediction ( if the confidence is high ) , or treats the image as an OL class and redirects it to the TN for classification . Binarization algorithm for student network : During adaptive training , the BSN does not have access to the labeled data and mimics the behavior of the TN on the IL classes as shown in Figure 1 ( b ) . For an input image x , let f ( g ( wi , j ) , x ) represent the output of the BSN where wi , j are real-valued weights of ith kernel in the jth layer , and g ( . ) is a binarizing function for these weights . During adaptive training , the error between the output of the BSN and TN is minimized by optimizing w∗i , j = arg ming ( wi , j ) ‖L‖ , where L is the overall loss function used for training the BSN . While the intermediate weight wi , j is computed during adaptive learning , the binary versions of these weights w∗i , j = g ( wi , j ) are used for fast computation . After convergence , the real valued weights are discarded , and only the binary weights are used . The question becomes what is a good choice for the binarization function g ( . ) ? Following Rastegari et al . ( 2016 ) , we find a binary vector bi , j ( whose elements are either +1 or −1 ) , and a non-negative scalar αi , j such that w∗i , j = αi , j .bi , j is the best approximation of wi , j in a minimum squared error sense , where αi , j = 1N |wi , j |1 , bi , j = sign ( wi , j ) . However , unlike Rastegari et al . ( 2016 ) where a standalone network is binarized , our BSN learns the w∗i , j during adaptive training in an online distillation framework . In doing so , the BSN compensates for the effects of binarization on the overall loss function . Our motivation for using the BSN is that it classifies the image stream with high accuracy and utilizes fewer FLOPs as compared to the RvSN . This results in an increase in efficiency of the overall framework . Furthermore , the BSN converges to the performance of the TN faster than the RvSN , which we theoretically emphasize in the Lemma below and experimentally validate in Section 4 . We provide the sketch proof here and the complete proof in Appendix A.1 . Lemma 3.1 . Let RvSN and BSN represent the real-valued student network and binary student network respectively with the same network architecture . Let R ( . ) denote the rate of convergence in terms of accuracy when the student network is adaptively trained using the pseudo-labels from the teacher network . Then , R ( BSN ) > R ( RvSN ) for the same image stream and number of iterations . Proof : We assume our image stream as x ( n ) where n = 1 , 2 , 3 ... N , comprises of N samples from the deployed scenario . Since the weights of the BSN are derived from the RvSN , we prove this lemma first for RvSN and then extend it to the BSN . Let w∗ be the optimal weight value which represents network convergence i.e . misclassification error = 0 . The weight update rule using back propagation is given by : w ( n+ 1 ) = w ( n ) + ηx ( n ) [ Since η = 1 ] w ( n+ 1 ) = w ( n ) + x ( n ) ( 1 ) Computing the bounds of the weights of the RvSN , we have n2α2 ‖w∗‖2 ≤ ‖w ( n+ 1 ) ‖2 ≤ nβ ( 2 ) where α = argminx ( n ) ∈C w ? x ( n ) and β = argmaxx ( n ) ∈C ‖x ( k ) ‖ 2 . From eq . 2 , we can say that for this inequality to be satisfied , there exists n ? r which denotes the optimal number of samples for which the RvSN converges i.e . we obtain w ? at n = n ? r . This is given as follows : n ? 2 r α 2 ‖w ? ‖2 = n ? rβ n ? r = β ‖w ? ‖2 α2 ( 3 ) Thus from eq . 3 , we can say that the RvSN achieves convergence after being trained on β‖w ∗‖2 α2 number of samples . Since , the weights of the BSN are derived from the RvSN , we substitute the value of binary weight ŵ∗ from Rastegari et al . ( 2016 ) to obtain n ? b = n ? r N ( 4 ) Here , n ? b is the optimal number of samples for which the BSN converges . Comparing eq . 3 and eq . 4 , we observe that number of n∗b < n ? r i.e . the BSN takes fewer samples to converge to the performance of the TN than RvSN given the same network architecture . Knowledge transfer from teacher to student network : Given an unlabeled image stream , the BSN is trained from the predictions of the TN as hard pseudo-labels using cross-entropy loss , as Ld = − 1N ∑ i yilog ( si ) . Here , y and s are the pseudo-labels generated by the TN and the softmax output of the BSN respectively , N is the total images in the image stream . Once the BSN converges to the performance of the TN , we employ the BSN as the primary classifier during inference . When the deployed scenario does not change for a long duration , the BSN classifies the IL classes faster than the TN without relying on the latter . This improves the overall efficiency of the framework as the TN is now used to classify only the OL classes ( number of OL images < < number of IL images ) . However , to maintain overall accuracy , the BSN must also accurately determine when the image from the input stream belongs to an OL class so that the TN can be used in such cases . We know that attention maps highlight the regions of the image responsible for the classifier ’ s prediction ( Li et al . ( 2018 ) ) . Some examples of the attention maps from the correct predictions of the BSN and the TN are shown in Figure 2 ( a ) . The first three columns in Figure 2 ( a ) show that although the BSN ( adaptively trained using Ld ) and the TN both correctly classify the images , their attention maps are significantly different . The attention map from the correct prediction of the BSN focuses on the background while that of the TN lies on the semantically meaningful regions of the image . Furthermore , the attention maps of the BSN ’ s correct and incorrect predictions are visually similar which causes the BSN to learn incorrect representations of the IL images while correctly classifying them . To better differentiate between IL and OL classes , the BSN should not memorize the predictions of the TN , but learn proper representations of the IL images . To achieve this , we propose the attention triplet loss given in Equation 5 that causes the BSN ’ s attention map to be similar to that of the TN while forcing the attention map from the BSN ’ s correct and incorrect prediction to be different . We use Grad-CAM ( Selvaraju et al . ( 2017 ) ) to compute the attention map A from the one-hot vector of the predicted class . To generate the attention map triplets , we use the attention map from the TN ’ s prediction At as the anchor . The hard positive attention map Asp is obtained from correct prediction of the BSN . When the BSN misclassifies an image ( prediction of BSN and TN are different ) , we use the label from the TN to compute Asp . Motivated by the findings in Wang et al . ( 2019 ) , we observe that the attention maps generated from the correct and incorrect predictions of the BSN are visually similar . Hence , we use the attention map from an incorrect prediction as the hard negative attention map Asn to enforce its separability from Asp . To avoid bad local minima and a collapsed model early on during training , mining suitable hard negatives are important ( Schroff et al . ( 2015 ) ) . Hence , we use the attention map from the second most probable class ( incorrect prediction ) as our hard negative due to its similarity with the hard positive ( third and fourth column in Figure 2 ( a ) ) . Thus , we formulate the attention triplet loss Lat as : Lat = 1 N 1 K N∑ n ( K∑ k ∥∥∥Atk −Aspk∥∥∥2 − K∑ k ∥∥∥Atk −Asnk∥∥∥2 + δ ) ( 5 ) Initially , the hard negative lies within the margin since its squared distance with the hard positive is small . Hence , Lat enforces separation between hard positive and hard negative by a distance greater than the value of margin δ , which we empirically set as 1.5 . N is the total number of samples and K is the total number of pixels in A . Using Lat and Ld , we formulate our final objective function as : Lf = λ1Ld + λ2Lat ( 6 ) where λ1 and λ2 are the weights of Ld and Lat which we empirically set as 1 and 0.2 respectively . The effect of Lat is shown in the last column of Figure 2 ( a ) where the BSN learns proper representations of the IL image due to its attention map being very similar to that of the TN ( second column ) . Furthermore , the improvement in feature space separation between the IL and OL classes in Figure 2 ( b ) shows that the BSN not only forms clusters of the different IL classes ( in red ) , but is also well separated from the OL classes ( in purple ) .
A knowledge distillation framework is proposed for efficient object recognition. In this framework, the teacher network (TN) performs high accuracy prediction while two student networks (SN) mimic the prediction from TN. The first SN learns from TN while the second SN is a binarized form (BSN) of the first SN. The design is made for online inference is that the BSN first recognizes the image, leaving the rare category objects to be recognized by the TN. Furthermore, an attention supervision scheme is proposed to enhance the CNN prediction by focusing on meaningful image content. The proposed method has been validated on CIFAR-100 and Tiny-Imagenet.
SP:22c51358e79eeee073c17182afec21de4f57148a
Enhancing Visual Representations for Efficient Object Recognition during Online Distillation
1 INTRODUCTION . Deep CNNs that are widely used for image classification ( Huang et al . ( 2017 ) ) often require large computing resources and process each image with high computational complexity ( Livni et al . ( 2014 ) ) . In real-world scenarios , the prior probability of occurrence of individual classes in an image stream is often unknown and varies with the deployed environment . For example , in a zoo , the image stream input to the deep CNN will mostly consist of animals , while that of vehicles would be rare . Other object classes such as furniture and aircraft would be absent . Therefore , only a subset of the many classes known to a deep CNN may be presented to it for classification during its deployment . To adapt to the varying prior class probability in the deployed scenario with high efficiency , we propose an online distillation framework - ENVISE . Here , we employ a high capacity general purpose image classifier as the teacher network ( TN ) , while the student network ( SN ) is a low capacity network . For greater efficiency and faster convergence , we require the coefficients of the SN to be binary and refer to it as the binary student network ( BSN ) . When the BSN is first deployed , it is trained on the unlabeled image stream using the predicted labels of the TN as pseudo-labels . Once the BSN converges to the performance of the TN , it is used as the primary classifier to rapidly classify the frequent classes faster than the TN . However , if a rare class appears ( i.e . a class absent during online training ) in the image stream , the BSN must accurately detect it as a class it has not yet encountered , which is then processed by the TN . Since the BSN is trained only on the frequent classes , we refer to these classes as inlier ( IL ) and the rare classes as outlier ( OL ) . It is important to note , that the OL classes are outliers with respect to the BSN only , but are known to the TN . Detecting extremely rare classes which are unknown to both the BSN and TN ( global unknowns ) is beyond the scope of this paper . Thus , assuming that the TN knows all possible classes from the deployed environment , we aim to increase the overall efficiency of the system ( without sacrificing performance ) by exploiting the higher probability of occurrence of frequent classes in a given scenario . Our approach for detecting OL classes is motivated from the observation by Ren et al . ( 2019 ) , where networks incorrectly learn to emphasize the background rather than the semantically important regions of the image leading to poor understanding of the IL classes . We know that attention maps highlight the regions of the image responsible for the classifier ’ s prediction ( Selvaraju et al . ( 2017 ) ) . We empirically observe that , the attention map of the BSN may focus on the background even when the attention map of the TN emphasizes the semantically meaningful regions of the image . In doing so , the BSN memorizes the labels of the TN , making it difficult to differentiate between the representations of IL and OL classes . To mitigate these issues , we propose an attention triplet loss that achieves two key objectives - a ) guide the attention map of the correct prediction of the BSN to focus on the semantically meaningful regions , and b ) simultaneously ensure that the attention map from the correct and incorrect predictions of the BSN are dissimilar . We show that by focusing on the semantically relevant regions of the image , the BSN will learn to distinguish between the representations of IL and OL classes , thereby improving its ability to detect OL classes . To assess the overall gain in efficiency of ENVISE , we propose a new evaluation metric - GiE , based on the number of times the BSN and TN are used to process the image stream . Since the deployed scene is comprised mostly of IL classes with few OL classes , we expect the BSN to be employed most of the time for classifying IL classes . The TN is used rarely i.e . only when the BSN detects an OL class . We refer to efficiency as the overall reduction in FLOPs in the online distillation framework to process the varying prior probability of classes in the image stream . This term differs from conventional model compression techniques ( Frankle & Carbin ( 2019 ) ; Chen et al . ( 2020 ) ) which process the image stream comprising of classes with equal probability using a single compressed model . To the best of our knowledge , we are the first to propose supervision on attention maps for OL detection , and a new evaluation metric that measures the gain in computational efficiency of an online distillation framework . A summary of our main contributions is : • Faster convergence of BSN : We theoretically justify and empirically illustrate that the BSN adapts to the performance of the TN faster than the real-valued SN ( RvSN ) . We also demonstrate the faster convergence of the BSN for different BSN architectures over its corresponding RvSN . • Attention triplet loss ( Lat ) , which guides the BSN to focus on the semantically meaningful regions of the image , thereby improving OL detection . • New evaluation metric - GiE to measure the overall gain in computational efficiency of the online distillation framework , and • We benchmark CIFAR-100 and tiny-imagenet datasets with SOTA OL detection meth- ods by creating meaningful IL and OL class pairs . ENVISE outperforms these baseline methods for OL detection , improves separation of IL and OL classes in the feature space , and yields the highest gain in computational efficiency . 2 RELATED WORK . Online distillation : Distilling knowledge to train a low-capacity student network from a highcapacity teacher network has been proposed as part of model compression ( Hinton et al . ( 2015 ) ) . Wang & Yoon ( 2020 ) provide a detailed review of different knowledge distillation methods . Mullapudi et al . ( 2019 ) propose an online distillation framework for semantic segmentation in videos , while Abolghasemi et al . ( 2019 ) use knowledge distillation to augment a visuomotor policy from visual attention . Lin et al . ( 2019 ) propose an ensemble student network that recursively learns from the teacher network in closed loop manner while Kim et al . ( 2019 ) use a feature fusion module to distill knowledge . Gao et al . ( 2019 ) propose online mutual learning and Cioppa et al . ( 2019 ) propose to periodically update weights to train an ensemble of student networks . These ensemble based methods require large computational resources and are expensive to train . However , ENVISE involves training a compact model that mimics the performance of the TN with less computation . Outlier detection : Outlier detection or out-of-distribution detection ( OOD ) refers to detecting a sample from an unknown class ( Hendrycks & Gimpel ( 2016 ) ) . Existing SOTA OOD methods use outlier samples during training or validation . Yu & Aizawa ( 2019 ) increase the distance between IL and OL samples during training while Vyas et al . ( 2018 ) ; Lee et al . ( 2018 ) add perturbations onto test images and train their network to differentiate between IL and OL samples . However in ENVISE , the BSN is adaptively trained only on IL class images without any knowledge of OL class images , which is a more realistic scenario . Without using outlier classes during training , Hendrycks & Gimpel ( 2016 ) ; Papadopoulos et al . ( 2019 ) ; Bendale & Boult ( 2016 ) ; Hendrycks et al . ( 2019 ) employ class probabilities or measure the similarity between IL and OL features . Yoshihashi et al . ( 2019 ) generate discriminative feature space using reconstruction based approaches . However , the likelihood of correct classification by these networks is based on background regions as described in Ren et al . ( 2019 ) . Hence , these methods fail when applied to real-world IL and OL class pairs since the confidence of prediction is based on background information . We overcome this drawback by proposing supervision on attention maps where we guide the BSN to focus on the important semantic regions using the attention map of the teacher network as a reference . This enables ENVISE to classify IL images with high confidence while also improving OL detection . 3 ONLINE DISTILLATION FOR EFFICIENT OBJECT RECOGNITION . The framework of ENVISE is shown in Figure 1 ( a ) . Initially , the TN ( indicated by “ 1 ” in the figure ) classifies the images from the input stream with high accuracy , albeit at a slower rate . The BSN ( red dotted box ) comprises of an adaptation module ( “ 2 ” ) and a binary CNN ( “ 3 ” ) . Given an image stream , the adaptation module learns the optimum binary weights to mimic the performance of the TN . Once its accuracy converges to that of the TN , the adaption of the real-valued weights stops , but the inference with binary weights continues . The OL detector ( “ 4 ” ) uses the softmax output of the BSN as confidence to either generate the final prediction ( if the confidence is high ) , or treats the image as an OL class and redirects it to the TN for classification . Binarization algorithm for student network : During adaptive training , the BSN does not have access to the labeled data and mimics the behavior of the TN on the IL classes as shown in Figure 1 ( b ) . For an input image x , let f ( g ( wi , j ) , x ) represent the output of the BSN where wi , j are real-valued weights of ith kernel in the jth layer , and g ( . ) is a binarizing function for these weights . During adaptive training , the error between the output of the BSN and TN is minimized by optimizing w∗i , j = arg ming ( wi , j ) ‖L‖ , where L is the overall loss function used for training the BSN . While the intermediate weight wi , j is computed during adaptive learning , the binary versions of these weights w∗i , j = g ( wi , j ) are used for fast computation . After convergence , the real valued weights are discarded , and only the binary weights are used . The question becomes what is a good choice for the binarization function g ( . ) ? Following Rastegari et al . ( 2016 ) , we find a binary vector bi , j ( whose elements are either +1 or −1 ) , and a non-negative scalar αi , j such that w∗i , j = αi , j .bi , j is the best approximation of wi , j in a minimum squared error sense , where αi , j = 1N |wi , j |1 , bi , j = sign ( wi , j ) . However , unlike Rastegari et al . ( 2016 ) where a standalone network is binarized , our BSN learns the w∗i , j during adaptive training in an online distillation framework . In doing so , the BSN compensates for the effects of binarization on the overall loss function . Our motivation for using the BSN is that it classifies the image stream with high accuracy and utilizes fewer FLOPs as compared to the RvSN . This results in an increase in efficiency of the overall framework . Furthermore , the BSN converges to the performance of the TN faster than the RvSN , which we theoretically emphasize in the Lemma below and experimentally validate in Section 4 . We provide the sketch proof here and the complete proof in Appendix A.1 . Lemma 3.1 . Let RvSN and BSN represent the real-valued student network and binary student network respectively with the same network architecture . Let R ( . ) denote the rate of convergence in terms of accuracy when the student network is adaptively trained using the pseudo-labels from the teacher network . Then , R ( BSN ) > R ( RvSN ) for the same image stream and number of iterations . Proof : We assume our image stream as x ( n ) where n = 1 , 2 , 3 ... N , comprises of N samples from the deployed scenario . Since the weights of the BSN are derived from the RvSN , we prove this lemma first for RvSN and then extend it to the BSN . Let w∗ be the optimal weight value which represents network convergence i.e . misclassification error = 0 . The weight update rule using back propagation is given by : w ( n+ 1 ) = w ( n ) + ηx ( n ) [ Since η = 1 ] w ( n+ 1 ) = w ( n ) + x ( n ) ( 1 ) Computing the bounds of the weights of the RvSN , we have n2α2 ‖w∗‖2 ≤ ‖w ( n+ 1 ) ‖2 ≤ nβ ( 2 ) where α = argminx ( n ) ∈C w ? x ( n ) and β = argmaxx ( n ) ∈C ‖x ( k ) ‖ 2 . From eq . 2 , we can say that for this inequality to be satisfied , there exists n ? r which denotes the optimal number of samples for which the RvSN converges i.e . we obtain w ? at n = n ? r . This is given as follows : n ? 2 r α 2 ‖w ? ‖2 = n ? rβ n ? r = β ‖w ? ‖2 α2 ( 3 ) Thus from eq . 3 , we can say that the RvSN achieves convergence after being trained on β‖w ∗‖2 α2 number of samples . Since , the weights of the BSN are derived from the RvSN , we substitute the value of binary weight ŵ∗ from Rastegari et al . ( 2016 ) to obtain n ? b = n ? r N ( 4 ) Here , n ? b is the optimal number of samples for which the BSN converges . Comparing eq . 3 and eq . 4 , we observe that number of n∗b < n ? r i.e . the BSN takes fewer samples to converge to the performance of the TN than RvSN given the same network architecture . Knowledge transfer from teacher to student network : Given an unlabeled image stream , the BSN is trained from the predictions of the TN as hard pseudo-labels using cross-entropy loss , as Ld = − 1N ∑ i yilog ( si ) . Here , y and s are the pseudo-labels generated by the TN and the softmax output of the BSN respectively , N is the total images in the image stream . Once the BSN converges to the performance of the TN , we employ the BSN as the primary classifier during inference . When the deployed scenario does not change for a long duration , the BSN classifies the IL classes faster than the TN without relying on the latter . This improves the overall efficiency of the framework as the TN is now used to classify only the OL classes ( number of OL images < < number of IL images ) . However , to maintain overall accuracy , the BSN must also accurately determine when the image from the input stream belongs to an OL class so that the TN can be used in such cases . We know that attention maps highlight the regions of the image responsible for the classifier ’ s prediction ( Li et al . ( 2018 ) ) . Some examples of the attention maps from the correct predictions of the BSN and the TN are shown in Figure 2 ( a ) . The first three columns in Figure 2 ( a ) show that although the BSN ( adaptively trained using Ld ) and the TN both correctly classify the images , their attention maps are significantly different . The attention map from the correct prediction of the BSN focuses on the background while that of the TN lies on the semantically meaningful regions of the image . Furthermore , the attention maps of the BSN ’ s correct and incorrect predictions are visually similar which causes the BSN to learn incorrect representations of the IL images while correctly classifying them . To better differentiate between IL and OL classes , the BSN should not memorize the predictions of the TN , but learn proper representations of the IL images . To achieve this , we propose the attention triplet loss given in Equation 5 that causes the BSN ’ s attention map to be similar to that of the TN while forcing the attention map from the BSN ’ s correct and incorrect prediction to be different . We use Grad-CAM ( Selvaraju et al . ( 2017 ) ) to compute the attention map A from the one-hot vector of the predicted class . To generate the attention map triplets , we use the attention map from the TN ’ s prediction At as the anchor . The hard positive attention map Asp is obtained from correct prediction of the BSN . When the BSN misclassifies an image ( prediction of BSN and TN are different ) , we use the label from the TN to compute Asp . Motivated by the findings in Wang et al . ( 2019 ) , we observe that the attention maps generated from the correct and incorrect predictions of the BSN are visually similar . Hence , we use the attention map from an incorrect prediction as the hard negative attention map Asn to enforce its separability from Asp . To avoid bad local minima and a collapsed model early on during training , mining suitable hard negatives are important ( Schroff et al . ( 2015 ) ) . Hence , we use the attention map from the second most probable class ( incorrect prediction ) as our hard negative due to its similarity with the hard positive ( third and fourth column in Figure 2 ( a ) ) . Thus , we formulate the attention triplet loss Lat as : Lat = 1 N 1 K N∑ n ( K∑ k ∥∥∥Atk −Aspk∥∥∥2 − K∑ k ∥∥∥Atk −Asnk∥∥∥2 + δ ) ( 5 ) Initially , the hard negative lies within the margin since its squared distance with the hard positive is small . Hence , Lat enforces separation between hard positive and hard negative by a distance greater than the value of margin δ , which we empirically set as 1.5 . N is the total number of samples and K is the total number of pixels in A . Using Lat and Ld , we formulate our final objective function as : Lf = λ1Ld + λ2Lat ( 6 ) where λ1 and λ2 are the weights of Ld and Lat which we empirically set as 1 and 0.2 respectively . The effect of Lat is shown in the last column of Figure 2 ( a ) where the BSN learns proper representations of the IL image due to its attention map being very similar to that of the TN ( second column ) . Furthermore , the improvement in feature space separation between the IL and OL classes in Figure 2 ( b ) shows that the BSN not only forms clusters of the different IL classes ( in red ) , but is also well separated from the OL classes ( in purple ) .
The proposed work trains a teacher-student network using an online distillation paradigm. The student is a binarized network (BSN) trained to be accurate on frequent classes. An attention triplet loss is employed to improve the accuracy of the BSN and its ability to detect outlier classes. Faster convergency of BSN vs Real Valued Student network is claimed. A new metric to evaluate the actual gain in network efficiency is proposed.
SP:22c51358e79eeee073c17182afec21de4f57148a
Whitening for Self-Supervised Representation Learning
1 INTRODUCTION . One of the current main bottlenecks in deep network training is the dependence on large annotated training datasets , and this motivates the recent surge of interest in unsupervised methods . Specifically , in self-supervised representation learning , a network is ( pre- ) trained without any form of manual annotation , thus providing a means to extract information from unlabeled-data sources ( e.g. , text corpora , videos , images from the Internet , etc. ) . In self-supervision , label information is replaced by a prediction problem using some form of context or using a pretext task . Pioneering work in this direction was done in Natural Language Processing ( NLP ) , in which the co-occurrence of words in a sentence is used to learn a language model ( Mikolov et al. , 2013a ; b ; Devlin et al. , 2019 ) . In Computer Vision , typical contexts or pretext tasks are based on : ( 1 ) the temporal consistency in videos ( Wang & Gupta , 2015 ; Misra et al. , 2016 ; Dwibedi et al. , 2019 ) , ( 2 ) the spatial order of patches in still images ( Noroozi & Favaro , 2016 ; Misra & van der Maaten , 2019 ; Hénaff et al. , 2019 ) or ( 3 ) simple image transformation techniques ( Ji et al. , 2019 ; He et al. , 2019 ; Wu et al. , 2018 ) . The intuitive idea behind most of these methods is to collect pairs of positive and negative samples : two positive samples should share the same semantics , while negatives should be perceptually different . A triplet loss ( Sohn , 2016 ; Schroff et al. , 2015 ; Hermans et al. , 2017 ; Wang & Gupta , 2015 ; Misra et al. , 2016 ) can then be used to learn a metric space which should represent the human perceptual similarity . However , most of the recent studies use a contrastive loss ( Hadsell et al. , 2006 ) or one of its variants ( Gutmann & Hyvärinen , 2010 ; van den Oord et al. , 2018 ; Hjelm et al. , 2019 ) , while Tschannen et al . ( 2019 ) show the relation between the triplet loss and the contrastive loss . It is worth noticing that the success of both kinds of losses is strongly affected by the number and the quality of the negative samples . For instance , in the case of the triplet loss , a common practice is to select hard/semi-hard negatives ( Schroff et al. , 2015 ; Hermans et al. , 2017 ) . On the other hand , Hjelm et al . ( 2019 ) have shown that the contrastive loss needs a large number of negatives to be competitive . This implies using batches with a large size , which is computationally demanding , especially with high-resolution images . In order to alleviate this problem , Wu et al . ( 2018 ) use a memory bank of negatives , which is composed of feature-vector representations of all the training samples . He et al . ( 2019 ) conjecture that the use of large and fixed-representation vocabularies is one of the keys to the success of self-supervision in NLP . The solution proposed by He et al . ( 2019 ) extends Wu et al . ( 2018 ) using a memory-efficient queue of the last visited negatives , together with a momentum encoder which preserves the intra-queue representation consistency . Chen et al . ( 2020 ) have performed large-scale experiments confirming that a large number of negatives ( and therefore a large batch size ) is required for the contrastive loss to be efficient . Concurrently with our work , Grill et al . ( 2020 ) have suggested that it is not necessary to rely on the contrastive scheme , introducing a high-performing alternative based on bootstrapping . In this paper we propose a new self-supervised loss function which first scatters all the sample representations in a spherical distribution1 and then penalizes the positive pairs which are far from each other . In more detail , given a set of samples V = { vi } , corresponding to the current minibatch of images B = { xi } , we first project the elements of V onto a spherical distribution using a whitening transform ( Siarohin et al. , 2019 ) . The whitened representations { zi } , corresponding to V , are normalized and then used to compute a Mean Squared Error ( MSE ) loss which accumulates the error taking into account only positive pairs ( zi , zj ) . We do not need to contrast positives against negatives as in the contrastive loss or in the triplet loss because the optimization process leads to shrinking the distance between positive pairs and , indirectly , scatters the other samples to satisfy the overall spherical-distribution constraint . In summary , our contributions are the following : • We propose a new loss function , Whitening MSE ( W-MSE ) , for self-supervised training . W-MSE constrains the batch samples to lie in a spherical distribution and it is an alternative to positive-negative instance contrasting methods . • Our loss does not rely on negatives , thus including more positive samples in the batch can be beneficial ; we indeed demonstrate that multiple positive pairs extracted from one image improve the performance . • We empirically show that our W-MSE loss outperforms the commonly adopted contrastive loss when measured using different standard classification protocols . We show that W-MSE is competitive with respect to state-of-the-art self-supervised methods . 2 BACKGROUND AND RELATED WORK . A typical self-supervised method is composed of two main components : a pretext task , which exploits some a-priori knowledge about the domain to automatically extract supervision from data , and a loss function . In this section we briefly review both aspects , and we additionally analyse the recent literature concerning feature whitening . Pretext Tasks . The temporal consistency in a video provides an intuitive form of self-supervision : temporally-close frames usually contain a similar semantic content ( Wang & Gupta , 2015 ; van den Oord et al. , 2018 ) . Misra et al . ( 2016 ) extended this idea using the relative temporal order of 3 frames , while Dwibedi et al . ( 2019 ) used a temporal cycle consistency for self-supervision , which is based on comparing two videos sharing the same semantics and computing inter-video frame-toframe nearest neighbour assignments . When dealing with still images , the most common pretext task is instance discrimination ( Wu et al . ( 2018 ) ) : from a training image x , a composition of data-augmentation techniques are used to extract two different views of x ( xi and xj ) . Commonly adopted transformations are : image cropping , rotation , color jittering , Sobel filtering , etc .. The learner is then required to discriminate ( xi , xj ) from other views extracted from other samples ( Wu et al. , 2018 ; Ji et al. , 2019 ; He et al. , 2019 ; Chen et al. , 2020 ) . Denoising auto-encoders ( Vincent et al. , 2008 ) add random noise to the input image and try to recover the original image . More sophisticated pretext tasks consist in predicting the spatial order of image patches ( Noroozi & Favaro , 2016 ; Misra & van der Maaten , 2019 ) or in reconstructing large masked regions of the image ( Pathak et al. , 2016 ) . Hjelm et al . ( 2019 ) ; Bachman et al . ( 2019 ) compare the holistic representation of an input image with a patch of the same image . Hénaff et al . 1Here and in the following , with “ spherical distribution ” we mean a distribution with a zero-mean and an identity-matrix covariance . ( 2019 ) use a similar idea , where the comparison depends on the patch order : the appearance of a given patch should be predicted given the appearance of the patches which lie above it in the image . In this paper we use standard data augmentation techniques on still images to obtain positive pairs , which is a simple method to get self-supervision ( Chen et al. , 2020 ) and does not require a pretexttask specific network architecture ( Hjelm et al. , 2019 ; Bachman et al. , 2019 ; Hénaff et al. , 2019 ) . Loss functions . Denoising auto-encoders use a reconstruction loss which compares the generated image with the input image before adding noise . Other generative methods use an adversarial loss in which a discriminator provides supervisory information to the generator ( Donahue et al. , 2017 ; Donahue & Simonyan , 2019 ) . Early self-supervised ( deep ) discriminative methods used a triplet loss ( Wang & Gupta , 2015 ; Misra et al. , 2016 ) : given two positive images xi , xj and a negative xk ( Sec . 1 ) , together with their corresponding latent-space representations zi , zj , zk , this loss penalizes those cases in which zi and zk are closer to each other than zi and zj plus a margin m : LTriplet = −max ( zTi zk − zTi zj +m , 0 ) . ( 1 ) Most of the recent self-supervised discriminative methods are based on some contrastive loss ( Hadsell et al. , 2006 ) variant , in which zi and zj are contrasted against a set of negative pairs . Following the common formulation proposed by van den Oord et al . ( 2018 ) : LContrastive = − log exp ( zTi zj/τ ) ∑K k=1 , k 6=i exp ( z T i zk/τ ) , ( 2 ) where τ is a temperature hyperparameter which should be manually set and the sum in the denominator is over a set of K − 1 negative samples . Usually K is the size of the current batch , i.e. , K = 2N , being N the number of the positive pairs . However , as shown by Hjelm et al . ( 2019 ) , the contrastive loss ( 2 ) requires a large number of negative samples to be competitive . Wu et al . ( 2018 ) ; He et al . ( 2019 ) use a set of negatives much larger than the current batch , by pre-computing latent-space representations of old samples . SimCLR ( Chen et al . ( 2020 ) ) uses a simpler , but computationally very demanding , solution based on large batches . While recent works ( van den Oord et al. , 2018 ; Hénaff et al. , 2019 ; Hjelm et al. , 2019 ; Bachman et al. , 2019 ; Ravanelli & Bengio , 2018 ) draw a relation between the contrastive loss and an estimate of the mutual information between the latent-space image representations , Tschannen et al . ( 2019 ) showed that the success of this loss is likely related to learning a metric space , similarly to what happens with a triplet loss . On the other hand , Wang & Isola ( 2020 ) showed that the L2 normalized contrastive loss asymptotically converges to the minimization of two desirable characteristics of the latent-space representations on the surface of the unit hypersphere : uniformity and semantic alignment . In the same paper , the authors propose two new losses ( Luniform and Lalign ) which explicitly deal with these characteristics . Concurrently with our work , BYOL ( Grill et al . ( 2020 ) ) proposes a “ bootstrapping ” scheme which is alternative to the positive-negative contrastive learning . In BYOL , an “ online ” network is optimised to predict the output of a “ target ” network , whose parameters are a running average of the online network . The predictions of the two networks are compared using an additional prediction network and an MSE loss . However , very recently , Fetterman & Albrecht ( 2020 ) and Tian et al . ( 2020 ) have empirically shown that BYOL can avoid a collapsed solution through the use of the Batch Norm ( BN ) ( Ioffe & Szegedy , 2015 ) which avoids constant representations . Our work can be seen as a generalization of this finding with a much simpler network architecture ( more details in Sec . 3.1 ) . In this paper we propose a different loss which is competitive with respect to other alternatives . Our loss formulation is simpler because it does not require a proper setting of the τ hyperparameter in equation 2 , m in equation 1 , or additional networks with a specific weight update schemes as in BYOL . Feature Whitening . We adopt the efficient and stable Cholesky decomposition ( Dereniowski & Marek , 2004 ) based whitening transform proposed by Siarohin et al . ( 2019 ) to project our latentspace vectors into a spherical distribution ( more details in Sec . 3 ) . Note that Huang et al . ( 2018 ) ; Siarohin et al . ( 2019 ) use whitening transforms in the intermediate layers of the network for a completely different task : extending BN to a multivariate batch normalization .
The paper proposes to first do representation "whitening", so that the representations are scattered in the space and not collapsing to a single data point; then compute distance metric on top of that (e.g. Euclidean, cosine similarity). A nice thing about explicit scattering is that it does not require large numbers of negative examples to pull the features apart. Experiments are done on several toy datasets like CIFAR.
SP:a3a46e67002f078845d83f3575b704160c30cffb
Whitening for Self-Supervised Representation Learning
1 INTRODUCTION . One of the current main bottlenecks in deep network training is the dependence on large annotated training datasets , and this motivates the recent surge of interest in unsupervised methods . Specifically , in self-supervised representation learning , a network is ( pre- ) trained without any form of manual annotation , thus providing a means to extract information from unlabeled-data sources ( e.g. , text corpora , videos , images from the Internet , etc. ) . In self-supervision , label information is replaced by a prediction problem using some form of context or using a pretext task . Pioneering work in this direction was done in Natural Language Processing ( NLP ) , in which the co-occurrence of words in a sentence is used to learn a language model ( Mikolov et al. , 2013a ; b ; Devlin et al. , 2019 ) . In Computer Vision , typical contexts or pretext tasks are based on : ( 1 ) the temporal consistency in videos ( Wang & Gupta , 2015 ; Misra et al. , 2016 ; Dwibedi et al. , 2019 ) , ( 2 ) the spatial order of patches in still images ( Noroozi & Favaro , 2016 ; Misra & van der Maaten , 2019 ; Hénaff et al. , 2019 ) or ( 3 ) simple image transformation techniques ( Ji et al. , 2019 ; He et al. , 2019 ; Wu et al. , 2018 ) . The intuitive idea behind most of these methods is to collect pairs of positive and negative samples : two positive samples should share the same semantics , while negatives should be perceptually different . A triplet loss ( Sohn , 2016 ; Schroff et al. , 2015 ; Hermans et al. , 2017 ; Wang & Gupta , 2015 ; Misra et al. , 2016 ) can then be used to learn a metric space which should represent the human perceptual similarity . However , most of the recent studies use a contrastive loss ( Hadsell et al. , 2006 ) or one of its variants ( Gutmann & Hyvärinen , 2010 ; van den Oord et al. , 2018 ; Hjelm et al. , 2019 ) , while Tschannen et al . ( 2019 ) show the relation between the triplet loss and the contrastive loss . It is worth noticing that the success of both kinds of losses is strongly affected by the number and the quality of the negative samples . For instance , in the case of the triplet loss , a common practice is to select hard/semi-hard negatives ( Schroff et al. , 2015 ; Hermans et al. , 2017 ) . On the other hand , Hjelm et al . ( 2019 ) have shown that the contrastive loss needs a large number of negatives to be competitive . This implies using batches with a large size , which is computationally demanding , especially with high-resolution images . In order to alleviate this problem , Wu et al . ( 2018 ) use a memory bank of negatives , which is composed of feature-vector representations of all the training samples . He et al . ( 2019 ) conjecture that the use of large and fixed-representation vocabularies is one of the keys to the success of self-supervision in NLP . The solution proposed by He et al . ( 2019 ) extends Wu et al . ( 2018 ) using a memory-efficient queue of the last visited negatives , together with a momentum encoder which preserves the intra-queue representation consistency . Chen et al . ( 2020 ) have performed large-scale experiments confirming that a large number of negatives ( and therefore a large batch size ) is required for the contrastive loss to be efficient . Concurrently with our work , Grill et al . ( 2020 ) have suggested that it is not necessary to rely on the contrastive scheme , introducing a high-performing alternative based on bootstrapping . In this paper we propose a new self-supervised loss function which first scatters all the sample representations in a spherical distribution1 and then penalizes the positive pairs which are far from each other . In more detail , given a set of samples V = { vi } , corresponding to the current minibatch of images B = { xi } , we first project the elements of V onto a spherical distribution using a whitening transform ( Siarohin et al. , 2019 ) . The whitened representations { zi } , corresponding to V , are normalized and then used to compute a Mean Squared Error ( MSE ) loss which accumulates the error taking into account only positive pairs ( zi , zj ) . We do not need to contrast positives against negatives as in the contrastive loss or in the triplet loss because the optimization process leads to shrinking the distance between positive pairs and , indirectly , scatters the other samples to satisfy the overall spherical-distribution constraint . In summary , our contributions are the following : • We propose a new loss function , Whitening MSE ( W-MSE ) , for self-supervised training . W-MSE constrains the batch samples to lie in a spherical distribution and it is an alternative to positive-negative instance contrasting methods . • Our loss does not rely on negatives , thus including more positive samples in the batch can be beneficial ; we indeed demonstrate that multiple positive pairs extracted from one image improve the performance . • We empirically show that our W-MSE loss outperforms the commonly adopted contrastive loss when measured using different standard classification protocols . We show that W-MSE is competitive with respect to state-of-the-art self-supervised methods . 2 BACKGROUND AND RELATED WORK . A typical self-supervised method is composed of two main components : a pretext task , which exploits some a-priori knowledge about the domain to automatically extract supervision from data , and a loss function . In this section we briefly review both aspects , and we additionally analyse the recent literature concerning feature whitening . Pretext Tasks . The temporal consistency in a video provides an intuitive form of self-supervision : temporally-close frames usually contain a similar semantic content ( Wang & Gupta , 2015 ; van den Oord et al. , 2018 ) . Misra et al . ( 2016 ) extended this idea using the relative temporal order of 3 frames , while Dwibedi et al . ( 2019 ) used a temporal cycle consistency for self-supervision , which is based on comparing two videos sharing the same semantics and computing inter-video frame-toframe nearest neighbour assignments . When dealing with still images , the most common pretext task is instance discrimination ( Wu et al . ( 2018 ) ) : from a training image x , a composition of data-augmentation techniques are used to extract two different views of x ( xi and xj ) . Commonly adopted transformations are : image cropping , rotation , color jittering , Sobel filtering , etc .. The learner is then required to discriminate ( xi , xj ) from other views extracted from other samples ( Wu et al. , 2018 ; Ji et al. , 2019 ; He et al. , 2019 ; Chen et al. , 2020 ) . Denoising auto-encoders ( Vincent et al. , 2008 ) add random noise to the input image and try to recover the original image . More sophisticated pretext tasks consist in predicting the spatial order of image patches ( Noroozi & Favaro , 2016 ; Misra & van der Maaten , 2019 ) or in reconstructing large masked regions of the image ( Pathak et al. , 2016 ) . Hjelm et al . ( 2019 ) ; Bachman et al . ( 2019 ) compare the holistic representation of an input image with a patch of the same image . Hénaff et al . 1Here and in the following , with “ spherical distribution ” we mean a distribution with a zero-mean and an identity-matrix covariance . ( 2019 ) use a similar idea , where the comparison depends on the patch order : the appearance of a given patch should be predicted given the appearance of the patches which lie above it in the image . In this paper we use standard data augmentation techniques on still images to obtain positive pairs , which is a simple method to get self-supervision ( Chen et al. , 2020 ) and does not require a pretexttask specific network architecture ( Hjelm et al. , 2019 ; Bachman et al. , 2019 ; Hénaff et al. , 2019 ) . Loss functions . Denoising auto-encoders use a reconstruction loss which compares the generated image with the input image before adding noise . Other generative methods use an adversarial loss in which a discriminator provides supervisory information to the generator ( Donahue et al. , 2017 ; Donahue & Simonyan , 2019 ) . Early self-supervised ( deep ) discriminative methods used a triplet loss ( Wang & Gupta , 2015 ; Misra et al. , 2016 ) : given two positive images xi , xj and a negative xk ( Sec . 1 ) , together with their corresponding latent-space representations zi , zj , zk , this loss penalizes those cases in which zi and zk are closer to each other than zi and zj plus a margin m : LTriplet = −max ( zTi zk − zTi zj +m , 0 ) . ( 1 ) Most of the recent self-supervised discriminative methods are based on some contrastive loss ( Hadsell et al. , 2006 ) variant , in which zi and zj are contrasted against a set of negative pairs . Following the common formulation proposed by van den Oord et al . ( 2018 ) : LContrastive = − log exp ( zTi zj/τ ) ∑K k=1 , k 6=i exp ( z T i zk/τ ) , ( 2 ) where τ is a temperature hyperparameter which should be manually set and the sum in the denominator is over a set of K − 1 negative samples . Usually K is the size of the current batch , i.e. , K = 2N , being N the number of the positive pairs . However , as shown by Hjelm et al . ( 2019 ) , the contrastive loss ( 2 ) requires a large number of negative samples to be competitive . Wu et al . ( 2018 ) ; He et al . ( 2019 ) use a set of negatives much larger than the current batch , by pre-computing latent-space representations of old samples . SimCLR ( Chen et al . ( 2020 ) ) uses a simpler , but computationally very demanding , solution based on large batches . While recent works ( van den Oord et al. , 2018 ; Hénaff et al. , 2019 ; Hjelm et al. , 2019 ; Bachman et al. , 2019 ; Ravanelli & Bengio , 2018 ) draw a relation between the contrastive loss and an estimate of the mutual information between the latent-space image representations , Tschannen et al . ( 2019 ) showed that the success of this loss is likely related to learning a metric space , similarly to what happens with a triplet loss . On the other hand , Wang & Isola ( 2020 ) showed that the L2 normalized contrastive loss asymptotically converges to the minimization of two desirable characteristics of the latent-space representations on the surface of the unit hypersphere : uniformity and semantic alignment . In the same paper , the authors propose two new losses ( Luniform and Lalign ) which explicitly deal with these characteristics . Concurrently with our work , BYOL ( Grill et al . ( 2020 ) ) proposes a “ bootstrapping ” scheme which is alternative to the positive-negative contrastive learning . In BYOL , an “ online ” network is optimised to predict the output of a “ target ” network , whose parameters are a running average of the online network . The predictions of the two networks are compared using an additional prediction network and an MSE loss . However , very recently , Fetterman & Albrecht ( 2020 ) and Tian et al . ( 2020 ) have empirically shown that BYOL can avoid a collapsed solution through the use of the Batch Norm ( BN ) ( Ioffe & Szegedy , 2015 ) which avoids constant representations . Our work can be seen as a generalization of this finding with a much simpler network architecture ( more details in Sec . 3.1 ) . In this paper we propose a different loss which is competitive with respect to other alternatives . Our loss formulation is simpler because it does not require a proper setting of the τ hyperparameter in equation 2 , m in equation 1 , or additional networks with a specific weight update schemes as in BYOL . Feature Whitening . We adopt the efficient and stable Cholesky decomposition ( Dereniowski & Marek , 2004 ) based whitening transform proposed by Siarohin et al . ( 2019 ) to project our latentspace vectors into a spherical distribution ( more details in Sec . 3 ) . Note that Huang et al . ( 2018 ) ; Siarohin et al . ( 2019 ) use whitening transforms in the intermediate layers of the network for a completely different task : extending BN to a multivariate batch normalization .
This paper proposes the mean square error loss with whitening operation to project positive pairs closely to each others while projecting the different positive pairs far away from each other on a unit sphere. This way, similar to BYOL, this paper removes the construction of negative pairs while improving the MoCo-V2 slightly on not very challenging benchmarks. The authors can find my questions/comments in the list below.
SP:a3a46e67002f078845d83f3575b704160c30cffb
Deep Retrieval: An End-to-End Structure Model for Large-Scale Recommendations
1 INTRODUCTION . Recommendation systems have gained great success in various commercial applications for decades . The objective of these systems is to retrieve relevant candidate items from an corpus based on user features and historical behaviors . One of the early successful techniques of recommendation systems is the collaborative filtering ( CF ) , which makes predictions based on the simple idea that similar users may prefer similar items . Item-based collaborative filtering ( Item-CF ) ( Sarwar et al. , 2001 ) extends the idea by considering the similarities between items and items , which lays the foundation for Amazon ’ s recommendation system ( Linden et al. , 2003 ) . In the Internet era , the amount of candidates from content platforms and the number of active users in those platforms rapidly grow to tens to hundreds of millions . The scalability , efficiency as well as accuracy are all challenging problems in the design of modern recommendation systems . Recently , vector-based retrieval methods have been widely adopted . The main idea is to embed users and items in a latent vector space , and use the inner product of vectors to represent the preference between users and items . Representative vector embedding methods include matrix factorization ( MF ) ( Mnih & Salakhutdinov , 2008 ; Koren et al. , 2009 ) , factorization machines ( FM ) ( Rendle , 2010 ) , DeepFM ( Guo et al. , 2017 ) , Field-aware FM ( FFM ) ( Juan et al. , 2016 ) , etc . However , when the number of items is large , the cost of brute-force computation of the inner product for all items can be prohibitive . Thus , maximum inner product search ( MIPS ) or approximate nearest neighbors ( ANN ) algorithms are usually used to retrieve top relevant items when the corpus is large . Efficient MIPS or ANN algorithms include tree-based algorithms ( Muja & Lowe , 2014 ; Houle & Nett , 2014 ) , locality sensitive hashing ( LSH ) ( Shrivastava & Li , 2014 ; Spring & Shrivastava , 2017 ) , product quantization ( PQ ) ( Jegou et al. , 2010 ; Ge et al. , 2013 ) , hierarchical navigable small world graphs ( HNSW ) ( Malkov & Yashunin , 2018 ) , etc . Despite their success in real world applications , vector-based algorithms has two main deficiencies : ( 1 ) The objective of learning vector representation and learning good MIPS structure are not well aligned for the recommendation task ; ( 2 ) The dependency on inner products of user and item embeddings might not be sufficient to capture the complicated structure of user-item interactions ( He et al. , 2017 ) . In order to break these limitations , tree based models ( Zhu et al. , 2018 ; 2019 ; Zhuo et al. , 2020 ) , TDM/JDM , have been proposed . These methods use a tree as indices and map each item to a leaf node of the tree . Learning objectives for model parameters and tree structures are well aligned to improve the accuracy . However , the number of parameters in these models are proportional to the number of clusters , making the tree structure itself difficult to learn — data available at the leaf level can be scarce and might not provide enough signal to learn a good tree at a finer level . In this paper , we proposed an end-to-end learnable structure model — Deep Retrieval ( DR ) . In DR , we use a K⇥D matrix as in Figure 1a for indexing , motivated by Chen et al . ( 2018 ) . In this structure , we define a path c as the forward index traverse over matrix columns . Each path is of length D with index value range { 1 , 2 , . . . , K } . There are KD possible paths and each path can be interpreted as a cluster of items . There are two major characteristics in designing the structure . First , There is no “ leaf node ” as that in a tree , so the data scarcity problem of learning the tree based model can be largely avoided in DR ’ s structure . Second , each item can be indexed by one or more paths — each path could contain multiple items and each item could also belong to multiple paths . This property is naturally accommodated using our probabilistic formulation of the DR model as we will show below . This multiple-to-multiple encoding scheme between items and paths differs significantly with the one-to-one mapping used in tree structure design . In training , the item paths are learnt together with the neural network parameters of the structure model using an expectation-maximization ( EM ) type algorithm ( Dempster et al. , 1977 ) . The entire training process is end-to-end and can be easily deployed for large-scale content platforms . The rest of the paper is organized as follows . In Section 2 , we describe the structure model and its structure objective function used in training in detail . We then introduce a beam search algorithm to find candidate paths in the inference stage . In Section 3 , we introduce the EM algorithm for training neural network parameters and paths of items jointly . In Section 4 , we demonstrate the performance of DR on two public datasets : MovieLens-20M1 and Amazon books2 . Experiment results show that DR can almost achieve the brute-force accuracy with sub-linear computational complexity . In Section 5 , we conclude the paper and discuss several possible future research directions . 2 DEEP RETRIEVAL : AN END-TO-END STRUCTURE MODEL . In this section , we introduce the DR structure model in detail . First , we show how we establish the probability function for user x to select path c given the model parameters ✓ . This follows the extension to the multi-path mechanism that enables DR to capture multi-aspect properties of items . 1https : //grouplens.org/datasets/movielens 2http : //jmcauley.ucsd.edu/data/amazon We then introduce the penalization design that prevents collapsing in allocating items to different paths . Next we describe the beam search algorithm for retrieval . Finally , we present the multi-task joint training procedure of DR with a reranking model . 2.1 THE DR MODEL . The basic model . The DR model consists of D layers with K nodes , with DK nodes in total . In each layer , we use a multi-layer perceptron ( MLP ) 3 with skip connections and softmax as output . Each layer takes an input vector and outputs a probability distribution over { 1 , 2 , . . . , K } based on parameters ✓ . Let V = { 1 , . . . , V } be the labels of all items and ⇡ : V ! [ K ] D be the mapping from items to paths . Assume we are given mapping ⇡ in this section and will introduce the algorithm for learning the mapping together with ✓ in Section 3 . In addition , for the mapping ⇡ , we assume an item only belongs to one path and we would extend it to the multi-path setting in next section . Given a pair of training sample ( x , y ) , which denotes a positive interaction ( click , convert , like , etc . ) between user x and item y , as well as the path c = ( c1 , c2 , . . . , cD ) associated with the item y , the probability p ( c|x , ✓ ) is constructed layer by layer as follows ( see Figure 1b for a flow chart ) , • The first layer takes the user embedding emb ( x ) as input , and outputs a probability p ( c1|x , ✓1 ) over the K nodes of the first layer , based on parameters ✓1 . • From the second layer onward , we concatenate the user embedding emb ( x ) and the embeddings of all the previous layers emb ( cd 1 ) ( called path embeddings ) as the input of MLP , and output p ( cd|x , c1 , . . . , cd 1 , ✓d ) over the K nodes of layer d , based on parameters ✓d . • The probability of path c given user x is the product of the probabilities of all the layers ’ outputs . p ( c|x , ✓ ) = DY d=1 p ( cd|x , c1 , . . . , cd 1 , ✓d ) . ( 1 ) Given a set of N training samples { ( xi , yi ) } Ni=1 , the log likelihood function of the structure model is Qstr ( ✓ , ⇡ ) = NX i=1 log p ( ⇡ ( yi ) |xi , ✓ ) . ( 2 ) The size of the input vector of layer d is the embedding size times d , and the size of the output vector is K. The parameters of layer d have a size of ⇥ ( Kd ) . The parameters ✓ contain the parameters ✓ds in all layers , as well as the path embeddings . The parameters in the entire model have an order of ⇥ ( KD2 ) , which is significantly smaller than the number of possible paths KD when D 2 . Multi-path extension . In tree-based deep models ( Zhu et al. , 2018 ; 2019 ) as well as the structure model we introduced above , each item belongs to only one cluster/path , limiting the capacity of the model to express multi-aspect information in real data . For example , an item related to kebab could belong to a “ food ” cluster . An item related to flowers could belong to a “ gift ” cluster . However , an item related to chocolate or cakes could belong to both clusters in order to be recommended to users interested in either food or gifts . In real world recommendation systems , a cluster might not have an explicit meaning such as food or gifts , but this example motivates us to assign each item to multiple clusters . In DR , we allow each item yi to be assigned to J different paths { ci,1 , . . . , ci , J } . Let ⇡ : V ! [ K ] D⇥J be the mapping from items to multiple paths . Then the multi-path structure objective is straightforwardly defined as , Qstr ( ✓ , ⇡ ) = NX i=1 log 0 @ JX j=1 p ( ci , j = ⇡j ( yi ) |xi , ✓ ) 1 A . ( 3 ) This is because the probability belonging to multiple paths is simply the summation of the probabilities belonging to individual paths . 3Other neural network architectures such as recurrent neural networks ( RNN ) can also be applied here . Since D is not very large in our settings , for simplicity , we use MLP . Penalization on size of paths . Directly optimizing Qstr ( ✓ , ⇡ ) w.r.t . the item-to-path mapping ⇡ could fail to ensure to allocate different items into different paths . ( We did observe this in practice . ) In an extreme case , we could allocate all items into a single path and the probability of seeing this single path given any user x is 1 as in Eq . 1 . This is because there is only one available path to chose from . However , this will not help on retrieving the top candidates since there is no differentiation among the items . We must regulate the possible distribution of ⇡ to be diverse . We introduce the following penalized likelihood function , Qpen ( ✓ , ⇡ ) = Qstr ( ✓ , ⇡ ) ↵ · X c2 [ K ] D f ( |c| ) ( 4 ) where ↵ is the penalty factor , |c| denotes the number of items allocated in path c and f is an increasing and convex function . A quadratic function f ( |c| ) = |c|2/2 controls the average size of paths , and higher order polynomials penalize more on larger paths . In our experiments , we use f ( |c| ) = |c|4/4 .
This paper presents an end-to-end deep retrieval method for recommendation. The model encodes all candidates into a discrete latent space, and learns the latent space parameters alongside the other neural network parameters. Recommendation is performed through beam search. The paper compares the method on two public dataset against several methods (DNN, CF, TDM) and concludes that it can achieve the same result as a brute-force solution in sub-linear time.
SP:f2a32676f88aaeda591223904a57338a1a2b699a
Deep Retrieval: An End-to-End Structure Model for Large-Scale Recommendations
1 INTRODUCTION . Recommendation systems have gained great success in various commercial applications for decades . The objective of these systems is to retrieve relevant candidate items from an corpus based on user features and historical behaviors . One of the early successful techniques of recommendation systems is the collaborative filtering ( CF ) , which makes predictions based on the simple idea that similar users may prefer similar items . Item-based collaborative filtering ( Item-CF ) ( Sarwar et al. , 2001 ) extends the idea by considering the similarities between items and items , which lays the foundation for Amazon ’ s recommendation system ( Linden et al. , 2003 ) . In the Internet era , the amount of candidates from content platforms and the number of active users in those platforms rapidly grow to tens to hundreds of millions . The scalability , efficiency as well as accuracy are all challenging problems in the design of modern recommendation systems . Recently , vector-based retrieval methods have been widely adopted . The main idea is to embed users and items in a latent vector space , and use the inner product of vectors to represent the preference between users and items . Representative vector embedding methods include matrix factorization ( MF ) ( Mnih & Salakhutdinov , 2008 ; Koren et al. , 2009 ) , factorization machines ( FM ) ( Rendle , 2010 ) , DeepFM ( Guo et al. , 2017 ) , Field-aware FM ( FFM ) ( Juan et al. , 2016 ) , etc . However , when the number of items is large , the cost of brute-force computation of the inner product for all items can be prohibitive . Thus , maximum inner product search ( MIPS ) or approximate nearest neighbors ( ANN ) algorithms are usually used to retrieve top relevant items when the corpus is large . Efficient MIPS or ANN algorithms include tree-based algorithms ( Muja & Lowe , 2014 ; Houle & Nett , 2014 ) , locality sensitive hashing ( LSH ) ( Shrivastava & Li , 2014 ; Spring & Shrivastava , 2017 ) , product quantization ( PQ ) ( Jegou et al. , 2010 ; Ge et al. , 2013 ) , hierarchical navigable small world graphs ( HNSW ) ( Malkov & Yashunin , 2018 ) , etc . Despite their success in real world applications , vector-based algorithms has two main deficiencies : ( 1 ) The objective of learning vector representation and learning good MIPS structure are not well aligned for the recommendation task ; ( 2 ) The dependency on inner products of user and item embeddings might not be sufficient to capture the complicated structure of user-item interactions ( He et al. , 2017 ) . In order to break these limitations , tree based models ( Zhu et al. , 2018 ; 2019 ; Zhuo et al. , 2020 ) , TDM/JDM , have been proposed . These methods use a tree as indices and map each item to a leaf node of the tree . Learning objectives for model parameters and tree structures are well aligned to improve the accuracy . However , the number of parameters in these models are proportional to the number of clusters , making the tree structure itself difficult to learn — data available at the leaf level can be scarce and might not provide enough signal to learn a good tree at a finer level . In this paper , we proposed an end-to-end learnable structure model — Deep Retrieval ( DR ) . In DR , we use a K⇥D matrix as in Figure 1a for indexing , motivated by Chen et al . ( 2018 ) . In this structure , we define a path c as the forward index traverse over matrix columns . Each path is of length D with index value range { 1 , 2 , . . . , K } . There are KD possible paths and each path can be interpreted as a cluster of items . There are two major characteristics in designing the structure . First , There is no “ leaf node ” as that in a tree , so the data scarcity problem of learning the tree based model can be largely avoided in DR ’ s structure . Second , each item can be indexed by one or more paths — each path could contain multiple items and each item could also belong to multiple paths . This property is naturally accommodated using our probabilistic formulation of the DR model as we will show below . This multiple-to-multiple encoding scheme between items and paths differs significantly with the one-to-one mapping used in tree structure design . In training , the item paths are learnt together with the neural network parameters of the structure model using an expectation-maximization ( EM ) type algorithm ( Dempster et al. , 1977 ) . The entire training process is end-to-end and can be easily deployed for large-scale content platforms . The rest of the paper is organized as follows . In Section 2 , we describe the structure model and its structure objective function used in training in detail . We then introduce a beam search algorithm to find candidate paths in the inference stage . In Section 3 , we introduce the EM algorithm for training neural network parameters and paths of items jointly . In Section 4 , we demonstrate the performance of DR on two public datasets : MovieLens-20M1 and Amazon books2 . Experiment results show that DR can almost achieve the brute-force accuracy with sub-linear computational complexity . In Section 5 , we conclude the paper and discuss several possible future research directions . 2 DEEP RETRIEVAL : AN END-TO-END STRUCTURE MODEL . In this section , we introduce the DR structure model in detail . First , we show how we establish the probability function for user x to select path c given the model parameters ✓ . This follows the extension to the multi-path mechanism that enables DR to capture multi-aspect properties of items . 1https : //grouplens.org/datasets/movielens 2http : //jmcauley.ucsd.edu/data/amazon We then introduce the penalization design that prevents collapsing in allocating items to different paths . Next we describe the beam search algorithm for retrieval . Finally , we present the multi-task joint training procedure of DR with a reranking model . 2.1 THE DR MODEL . The basic model . The DR model consists of D layers with K nodes , with DK nodes in total . In each layer , we use a multi-layer perceptron ( MLP ) 3 with skip connections and softmax as output . Each layer takes an input vector and outputs a probability distribution over { 1 , 2 , . . . , K } based on parameters ✓ . Let V = { 1 , . . . , V } be the labels of all items and ⇡ : V ! [ K ] D be the mapping from items to paths . Assume we are given mapping ⇡ in this section and will introduce the algorithm for learning the mapping together with ✓ in Section 3 . In addition , for the mapping ⇡ , we assume an item only belongs to one path and we would extend it to the multi-path setting in next section . Given a pair of training sample ( x , y ) , which denotes a positive interaction ( click , convert , like , etc . ) between user x and item y , as well as the path c = ( c1 , c2 , . . . , cD ) associated with the item y , the probability p ( c|x , ✓ ) is constructed layer by layer as follows ( see Figure 1b for a flow chart ) , • The first layer takes the user embedding emb ( x ) as input , and outputs a probability p ( c1|x , ✓1 ) over the K nodes of the first layer , based on parameters ✓1 . • From the second layer onward , we concatenate the user embedding emb ( x ) and the embeddings of all the previous layers emb ( cd 1 ) ( called path embeddings ) as the input of MLP , and output p ( cd|x , c1 , . . . , cd 1 , ✓d ) over the K nodes of layer d , based on parameters ✓d . • The probability of path c given user x is the product of the probabilities of all the layers ’ outputs . p ( c|x , ✓ ) = DY d=1 p ( cd|x , c1 , . . . , cd 1 , ✓d ) . ( 1 ) Given a set of N training samples { ( xi , yi ) } Ni=1 , the log likelihood function of the structure model is Qstr ( ✓ , ⇡ ) = NX i=1 log p ( ⇡ ( yi ) |xi , ✓ ) . ( 2 ) The size of the input vector of layer d is the embedding size times d , and the size of the output vector is K. The parameters of layer d have a size of ⇥ ( Kd ) . The parameters ✓ contain the parameters ✓ds in all layers , as well as the path embeddings . The parameters in the entire model have an order of ⇥ ( KD2 ) , which is significantly smaller than the number of possible paths KD when D 2 . Multi-path extension . In tree-based deep models ( Zhu et al. , 2018 ; 2019 ) as well as the structure model we introduced above , each item belongs to only one cluster/path , limiting the capacity of the model to express multi-aspect information in real data . For example , an item related to kebab could belong to a “ food ” cluster . An item related to flowers could belong to a “ gift ” cluster . However , an item related to chocolate or cakes could belong to both clusters in order to be recommended to users interested in either food or gifts . In real world recommendation systems , a cluster might not have an explicit meaning such as food or gifts , but this example motivates us to assign each item to multiple clusters . In DR , we allow each item yi to be assigned to J different paths { ci,1 , . . . , ci , J } . Let ⇡ : V ! [ K ] D⇥J be the mapping from items to multiple paths . Then the multi-path structure objective is straightforwardly defined as , Qstr ( ✓ , ⇡ ) = NX i=1 log 0 @ JX j=1 p ( ci , j = ⇡j ( yi ) |xi , ✓ ) 1 A . ( 3 ) This is because the probability belonging to multiple paths is simply the summation of the probabilities belonging to individual paths . 3Other neural network architectures such as recurrent neural networks ( RNN ) can also be applied here . Since D is not very large in our settings , for simplicity , we use MLP . Penalization on size of paths . Directly optimizing Qstr ( ✓ , ⇡ ) w.r.t . the item-to-path mapping ⇡ could fail to ensure to allocate different items into different paths . ( We did observe this in practice . ) In an extreme case , we could allocate all items into a single path and the probability of seeing this single path given any user x is 1 as in Eq . 1 . This is because there is only one available path to chose from . However , this will not help on retrieving the top candidates since there is no differentiation among the items . We must regulate the possible distribution of ⇡ to be diverse . We introduce the following penalized likelihood function , Qpen ( ✓ , ⇡ ) = Qstr ( ✓ , ⇡ ) ↵ · X c2 [ K ] D f ( |c| ) ( 4 ) where ↵ is the penalty factor , |c| denotes the number of items allocated in path c and f is an increasing and convex function . A quadratic function f ( |c| ) = |c|2/2 controls the average size of paths , and higher order polynomials penalize more on larger paths . In our experiments , we use f ( |c| ) = |c|4/4 .
The paper presents a method for "end-to-end" learning for retrieving top-k items in recommendation system setup. This is achieved by learning the hidden representations of the items and under neural network as a single objective function optimized using the expectation maximization framework. It is claimed that the proposed method achives better results than state-of-the-art tree-based models and those approaches which learn these components separately.
SP:f2a32676f88aaeda591223904a57338a1a2b699a
Imagine That! Leveraging Emergent Affordances for 3D Tool Synthesis
1 INTRODUCTION . The advent of deep generative models ( e.g . Burgess et al. , 2019 ; Greff et al. , 2019 ; Engelcke et al. , 2019 ) with their aptitude for unsupervised representation learning casts a new light on learning affordances ( Gibson , 1977 ) . This kind of representation learning raises a tantalising question : Given that generative models naturally capture factors of variation , could they also be used to expose these factors such that they can be modified in a task-driven way ? We posit that a task-driven traversal of a structured latent space leads to affordances emerging naturally along trajectories in this space . This is in stark contrast to more common approaches to affordance learning where it is achieved via direct supervision or implicitly via imitation ( e.g . Tikhanoff et al. , 2013 ; Myers et al. , 2015 ; Liu et al. , 2018 ; Grabner et al. , 2011 ; Do et al. , 2018 ) . The setting we choose for our investigation is that of tool synthesis for reaching tasks as commonly investigated in the cognitive sciences ( Ambrose , 2001 ; Emery & Clayton , 2009 ) . In order to demonstrate that a task-aware latent space encodes useful affordance information we require a mechanism to train such a model as well as to purposefully explore the space . To this end we propose an architecture in which a task-based performance predictor ( a classifier ) operates on the latent space of a generative model ( see fig . 1 ) . During training the classifier is used to provide an auxiliary objective , aiding in shaping the latent space . Importantly , however , during test time the performance predictor is used to guide exploration of the latent space via activation maximisation ( Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) , thus explicitly exploiting the structure of the space . While our desire to affect factors of influence is similar in spirit to the notion of disentanglement , it contrasts significantly with models such as β-VAE ( Higgins et al. , 2017 ) , where the factors of influence are effectively encouraged to be axis-aligned . Our approach instead relies on a high-level auxiliary loss to discover the direction in latent space to explore . Our experiments demonstrate that artificial agents are able to imagine an appropriate tool for a variety of reaching tasks by manipulating the tool ’ s task-relevant affordances . To the best of our knowledge , this makes us the first to demonstrate an artificial agent ’ s ability to imagine , or synthesise , 3D meshes of tools appropriate for a given task via optimisation in a structured latent embedding . Similarly , while activation maximisation has been used to visualise modified input images before ( e.g . Mordvintsev et al. , 2015 ) , we believe this work to be the first to effect deliberate manipulation of factors of influence by chaining the outcome of a task predictor to the latent space , and then decoding the latent representation back into a 3D mesh . Beyond the application of tool synthesis , we believe our work to provide novel perspectives on affordance learning and disentanglement in demonstrating that object affordances can be viewed as trajectories in a structured latent space as well as by providing a novel architecture adept at deliberately manipulating interpretable factors of influence . 2 RELATED WORK . The concept of an affordance , which describes a potential action to be performed on an object ( e.g . a doorknob affords being turned ) , goes back to Gibson ( 1977 ) . Because of their importance in cognitive vision , affordances are extensively studied in computer vision and robotics . Commonly , affordances are learned in a supervised fashion where models discriminate between discrete affordance classes or predict masks for image regions which afford certain types of human interaction ( e.g . Stoytchev , 2005 ; Kjellström et al. , 2010 ; Tikhanoff et al. , 2013 ; Mar et al. , 2015 ; Myers et al. , 2015 ; Do et al. , 2018 ) . Interestingly , most works in this domain learn from object shapes which have been given an affordance label a priori . However , the affordance of a shape is only properly defined in the context of a task . Hence , we employ a task-driven traversal of a latent space to optimise the shape of a tool by exploiting factors of variation which are conducive to task success . Recent advances in 3D shape generation employ variational models ( Girdhar et al. , 2016 ; Wu et al. , 2016 ) to capture complex manifolds of 3D objects . Besides their expressive capabilities , the latent spaces of such models also enable smooth interpolation between shapes . Remarkable results have been demonstrated including ‘ shape algebra ’ ( Wu et al. , 2016 ) and the preservation of object part semantics ( Kohli et al. , 2020 ) and fine-grained shape styles ( Yifan et al. , 2019 ) during interpolation . This shows the potential of disentangling meaningful factors of variation in the latent representation of 3D shapes . Inspired by this , we investigate whether these factors can be exposed in a taskdriven way . In particular , we propose an architecture in which a generative model for 3D object reconstruction ( Liu et al. , 2019 ) is paired with activation maximisation ( e.g . Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) of a task-driven performance predictor . Guided by its loss signal , activation maximisation traverses the generative model ’ s latent representations and drives an imagination process yielding a shape suitable for the task at hand . A key application of affordance-driven shape imagination is tool use . Robotics boasts a mature body of literature studying how robots can utilise tools to improve their performance across a wide range of tasks like reaching ( Jamone et al. , 2015 ) , grasping ( Takahashi et al. , 2017 ) , pushing ( Stoytchev , 2005 ) and hammering ( Fang et al. , 2018 ) . The pipeline executing tool-based tasks typically starts with models for tool recognition and selection ( e.g . Tikhanoff et al. , 2013 ; Zhu et al. , 2015 ; Fang et al. , 2018 ; Saito et al. , 2018 ; Xie et al. , 2019 ) before tool properties and affordances are leveraged to compute higher-order plans ( Toussaint et al. , 2018 ) . Our proposed model lends itself to robotics applications like these , as the learned latent space encodes a rich object-centric representation of tools that are biased for specific tasks . 3 METHOD . Our overarching goal is to perform task-specific tool synthesis for 3D reaching tasks . We frame the challenge of tool imagination as an optimisation problem in a structured latent space obtained using a generative model . The optimisation is driven by a high-level , task-specific performance predictor , which assesses whether a target specified by a goal image IG is reachable given a particular tool and in the presence of obstacles . To map from tool images into manipulable 3D tools , we first train an off-the-shelf 3D single-view reconstruction model taking as input tool images IiT , I j T and corresponding tool silhouettes IiS , I j S as rendered from two different vantage points i and j . After training , the encoder can infer the tool representation that contains the 3D structure information given a single-view RGB image and its silhouette as input . This representation is implicitly used to optimise the tool configuration to make it suitable for the task at hand . An overview of our model is given in fig . 2 . More formally , we consider N data instances : { ( InG , In , iT , In , jT , In , iS , In , jS , ρn ) } Nn=1 , where each example features a task image IG , tool images IT in two randomly selected views i and j , and their corresponding silhouettes IS , as well as a binary label ρ indicating the feasibility of reaching the target with the given tool . Examples of task images and model inputs are shown in fig . 3 . In all our experiments , we restrict the training input to such sparse high-level instances . For additional details on the dataset , we refer the reader to the supplementary material . 3.1 REPRESENTING TASKS AND TOOLS . Given that our tools are presented in tool images IT , it is necessary for the first processing step to perform a 3D reconstruction of IT , from pixels into meshes . To achieve this single view 3D reconstruction of images into their meshes , we employ the same architecture as proposed by ( Kato et al. , 2018 ; Wang et al. , 2018 ) . The 3D reconstruction model consists of two parts : an encoder network and a mesh decoder . Given the tool image and its silhouette in view i , i.e IiT and I i S , we denote the latent variable encoding the tool computed by the encoder , ψ , as ψ ( IiT , I i S ) = zT . ( 1 ) The mesh decoder takes zT as input and synthesises the mesh by deforming a template . A differentiable renderer ( Liu et al. , 2019 ) predicts the tool ’ s silhoutte ÎjS in another view j , which is compared to the ground-truth silhouette IjS to compute the silhouette loss Ls . This silhouette loss Ls together with an auxiliary geometry loss Lg formulates the total 3D reconstruction loss : Lrecon = Ls + µLg , ( 2 ) where µ is the weight of the geometry loss . We refer the reader to Liu et al . ( 2019 ) regarding the exact hyper-parameter and training setup of the 3D reconstruction model . Task images IG are similarly represented in an abstract latent space . For this we employ a task encoder , φ , which consists of a stack of convolutional layers.1 φ takes the task image IG as input and maps it into the task embedding zG . 3.2 TOOL IMAGINATION . Task-driven learning The tool representation zT contains task-relevant information such as tool length , width , and shape . In order to perform tool imagination , the sub-manifold of the latent space that corresponds to the task-relevant features needs to be accessed and traversed . This is achieved by adding a three-layer MLP as a classifier σ . The classifier σ takes as input a concatenation hcat of the task embedding zG and the tool representation zT , and predicts the softmax over the binary task 1Architecture details are provided in the supplementary material . success . The classifier learns to identify the task-relevant sub-manifold of the latent space by using the sparse success signal ρ and optimising the binary-cross entropy loss , such that Ltask ( σ ( hcat ) , ρ ) = − ( ρ log ( σ ( hcat ) ) + ( 1− ρ ) log ( 1− σ ( hcat ) ) ) , ( 3 ) where ρ ∈ { 0 , 1 } is a binary signal indicating whether or not it is feasible to solve the task with the given tool . The whole system is trained end-to-end with a loss given by L � IG , I i T , I i S , I j T , I j S , ρ � = Lrecon + Ltask . ( 4 ) Note that the gradient from the task classifier σ propagates through both the task encoder φ and the toolkit encoder ψ , and therefore helps to shape the latent representations of the toolkit with respect to the requirements for task success . Tool imagination Once trained , our model can synthesise new tools by traversing the latent manifold of individual tools following the trajectories that maximise classification success given a tool image and its silhouette ( fig . 2 ) . To do this , we first pick a tool candidate and concatenate its representation zT with the task embedding zG . This warm-starts the imagination process . The concatenated embedding hcat is then fed into the performance predictor σ to compute the gradient with respect to the tool embedding zT . We then use activation maximisation ( Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) to optimise zT with regard to Ltask of the success estimation σ ( hcat ) and a feasibility target ρs = 1 , such that zT = zT + η ∂Ltask ( σ ( zT ) , ρs ) ∂zT , ( 5 ) where η denotes the learning rate for the update . Finally , we apply this gradient update for S steps or until the success estimation σ ( zT ) reaches a threshold γ , and use ψ� ( zT ) to generate the imagined 3D tool mesh represented by zT .
This paper presents a method with two goals: (1) estimate if a given tool can solve a given task, and (2) generate a tool that can solve a given task. One encoder maps a tool image and silhouette into a latent code, and a decoder maps this code into a mesh; another encoder maps a task image into a latent code; this code is concatenated with the tool code, then mapped to a task success probability. The networks are trained together, so that task success probability has some impact on the tool encoder's latent space. Results show that the model is largely successful in both tasks, but no challenging baselines are here.
SP:a43b09142b12e0b68e3e658a9011068615c46481
Imagine That! Leveraging Emergent Affordances for 3D Tool Synthesis
1 INTRODUCTION . The advent of deep generative models ( e.g . Burgess et al. , 2019 ; Greff et al. , 2019 ; Engelcke et al. , 2019 ) with their aptitude for unsupervised representation learning casts a new light on learning affordances ( Gibson , 1977 ) . This kind of representation learning raises a tantalising question : Given that generative models naturally capture factors of variation , could they also be used to expose these factors such that they can be modified in a task-driven way ? We posit that a task-driven traversal of a structured latent space leads to affordances emerging naturally along trajectories in this space . This is in stark contrast to more common approaches to affordance learning where it is achieved via direct supervision or implicitly via imitation ( e.g . Tikhanoff et al. , 2013 ; Myers et al. , 2015 ; Liu et al. , 2018 ; Grabner et al. , 2011 ; Do et al. , 2018 ) . The setting we choose for our investigation is that of tool synthesis for reaching tasks as commonly investigated in the cognitive sciences ( Ambrose , 2001 ; Emery & Clayton , 2009 ) . In order to demonstrate that a task-aware latent space encodes useful affordance information we require a mechanism to train such a model as well as to purposefully explore the space . To this end we propose an architecture in which a task-based performance predictor ( a classifier ) operates on the latent space of a generative model ( see fig . 1 ) . During training the classifier is used to provide an auxiliary objective , aiding in shaping the latent space . Importantly , however , during test time the performance predictor is used to guide exploration of the latent space via activation maximisation ( Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) , thus explicitly exploiting the structure of the space . While our desire to affect factors of influence is similar in spirit to the notion of disentanglement , it contrasts significantly with models such as β-VAE ( Higgins et al. , 2017 ) , where the factors of influence are effectively encouraged to be axis-aligned . Our approach instead relies on a high-level auxiliary loss to discover the direction in latent space to explore . Our experiments demonstrate that artificial agents are able to imagine an appropriate tool for a variety of reaching tasks by manipulating the tool ’ s task-relevant affordances . To the best of our knowledge , this makes us the first to demonstrate an artificial agent ’ s ability to imagine , or synthesise , 3D meshes of tools appropriate for a given task via optimisation in a structured latent embedding . Similarly , while activation maximisation has been used to visualise modified input images before ( e.g . Mordvintsev et al. , 2015 ) , we believe this work to be the first to effect deliberate manipulation of factors of influence by chaining the outcome of a task predictor to the latent space , and then decoding the latent representation back into a 3D mesh . Beyond the application of tool synthesis , we believe our work to provide novel perspectives on affordance learning and disentanglement in demonstrating that object affordances can be viewed as trajectories in a structured latent space as well as by providing a novel architecture adept at deliberately manipulating interpretable factors of influence . 2 RELATED WORK . The concept of an affordance , which describes a potential action to be performed on an object ( e.g . a doorknob affords being turned ) , goes back to Gibson ( 1977 ) . Because of their importance in cognitive vision , affordances are extensively studied in computer vision and robotics . Commonly , affordances are learned in a supervised fashion where models discriminate between discrete affordance classes or predict masks for image regions which afford certain types of human interaction ( e.g . Stoytchev , 2005 ; Kjellström et al. , 2010 ; Tikhanoff et al. , 2013 ; Mar et al. , 2015 ; Myers et al. , 2015 ; Do et al. , 2018 ) . Interestingly , most works in this domain learn from object shapes which have been given an affordance label a priori . However , the affordance of a shape is only properly defined in the context of a task . Hence , we employ a task-driven traversal of a latent space to optimise the shape of a tool by exploiting factors of variation which are conducive to task success . Recent advances in 3D shape generation employ variational models ( Girdhar et al. , 2016 ; Wu et al. , 2016 ) to capture complex manifolds of 3D objects . Besides their expressive capabilities , the latent spaces of such models also enable smooth interpolation between shapes . Remarkable results have been demonstrated including ‘ shape algebra ’ ( Wu et al. , 2016 ) and the preservation of object part semantics ( Kohli et al. , 2020 ) and fine-grained shape styles ( Yifan et al. , 2019 ) during interpolation . This shows the potential of disentangling meaningful factors of variation in the latent representation of 3D shapes . Inspired by this , we investigate whether these factors can be exposed in a taskdriven way . In particular , we propose an architecture in which a generative model for 3D object reconstruction ( Liu et al. , 2019 ) is paired with activation maximisation ( e.g . Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) of a task-driven performance predictor . Guided by its loss signal , activation maximisation traverses the generative model ’ s latent representations and drives an imagination process yielding a shape suitable for the task at hand . A key application of affordance-driven shape imagination is tool use . Robotics boasts a mature body of literature studying how robots can utilise tools to improve their performance across a wide range of tasks like reaching ( Jamone et al. , 2015 ) , grasping ( Takahashi et al. , 2017 ) , pushing ( Stoytchev , 2005 ) and hammering ( Fang et al. , 2018 ) . The pipeline executing tool-based tasks typically starts with models for tool recognition and selection ( e.g . Tikhanoff et al. , 2013 ; Zhu et al. , 2015 ; Fang et al. , 2018 ; Saito et al. , 2018 ; Xie et al. , 2019 ) before tool properties and affordances are leveraged to compute higher-order plans ( Toussaint et al. , 2018 ) . Our proposed model lends itself to robotics applications like these , as the learned latent space encodes a rich object-centric representation of tools that are biased for specific tasks . 3 METHOD . Our overarching goal is to perform task-specific tool synthesis for 3D reaching tasks . We frame the challenge of tool imagination as an optimisation problem in a structured latent space obtained using a generative model . The optimisation is driven by a high-level , task-specific performance predictor , which assesses whether a target specified by a goal image IG is reachable given a particular tool and in the presence of obstacles . To map from tool images into manipulable 3D tools , we first train an off-the-shelf 3D single-view reconstruction model taking as input tool images IiT , I j T and corresponding tool silhouettes IiS , I j S as rendered from two different vantage points i and j . After training , the encoder can infer the tool representation that contains the 3D structure information given a single-view RGB image and its silhouette as input . This representation is implicitly used to optimise the tool configuration to make it suitable for the task at hand . An overview of our model is given in fig . 2 . More formally , we consider N data instances : { ( InG , In , iT , In , jT , In , iS , In , jS , ρn ) } Nn=1 , where each example features a task image IG , tool images IT in two randomly selected views i and j , and their corresponding silhouettes IS , as well as a binary label ρ indicating the feasibility of reaching the target with the given tool . Examples of task images and model inputs are shown in fig . 3 . In all our experiments , we restrict the training input to such sparse high-level instances . For additional details on the dataset , we refer the reader to the supplementary material . 3.1 REPRESENTING TASKS AND TOOLS . Given that our tools are presented in tool images IT , it is necessary for the first processing step to perform a 3D reconstruction of IT , from pixels into meshes . To achieve this single view 3D reconstruction of images into their meshes , we employ the same architecture as proposed by ( Kato et al. , 2018 ; Wang et al. , 2018 ) . The 3D reconstruction model consists of two parts : an encoder network and a mesh decoder . Given the tool image and its silhouette in view i , i.e IiT and I i S , we denote the latent variable encoding the tool computed by the encoder , ψ , as ψ ( IiT , I i S ) = zT . ( 1 ) The mesh decoder takes zT as input and synthesises the mesh by deforming a template . A differentiable renderer ( Liu et al. , 2019 ) predicts the tool ’ s silhoutte ÎjS in another view j , which is compared to the ground-truth silhouette IjS to compute the silhouette loss Ls . This silhouette loss Ls together with an auxiliary geometry loss Lg formulates the total 3D reconstruction loss : Lrecon = Ls + µLg , ( 2 ) where µ is the weight of the geometry loss . We refer the reader to Liu et al . ( 2019 ) regarding the exact hyper-parameter and training setup of the 3D reconstruction model . Task images IG are similarly represented in an abstract latent space . For this we employ a task encoder , φ , which consists of a stack of convolutional layers.1 φ takes the task image IG as input and maps it into the task embedding zG . 3.2 TOOL IMAGINATION . Task-driven learning The tool representation zT contains task-relevant information such as tool length , width , and shape . In order to perform tool imagination , the sub-manifold of the latent space that corresponds to the task-relevant features needs to be accessed and traversed . This is achieved by adding a three-layer MLP as a classifier σ . The classifier σ takes as input a concatenation hcat of the task embedding zG and the tool representation zT , and predicts the softmax over the binary task 1Architecture details are provided in the supplementary material . success . The classifier learns to identify the task-relevant sub-manifold of the latent space by using the sparse success signal ρ and optimising the binary-cross entropy loss , such that Ltask ( σ ( hcat ) , ρ ) = − ( ρ log ( σ ( hcat ) ) + ( 1− ρ ) log ( 1− σ ( hcat ) ) ) , ( 3 ) where ρ ∈ { 0 , 1 } is a binary signal indicating whether or not it is feasible to solve the task with the given tool . The whole system is trained end-to-end with a loss given by L � IG , I i T , I i S , I j T , I j S , ρ � = Lrecon + Ltask . ( 4 ) Note that the gradient from the task classifier σ propagates through both the task encoder φ and the toolkit encoder ψ , and therefore helps to shape the latent representations of the toolkit with respect to the requirements for task success . Tool imagination Once trained , our model can synthesise new tools by traversing the latent manifold of individual tools following the trajectories that maximise classification success given a tool image and its silhouette ( fig . 2 ) . To do this , we first pick a tool candidate and concatenate its representation zT with the task embedding zG . This warm-starts the imagination process . The concatenated embedding hcat is then fed into the performance predictor σ to compute the gradient with respect to the tool embedding zT . We then use activation maximisation ( Erhan et al. , 2009 ; Zeiler & Fergus , 2014 ; Simonyan et al. , 2014 ) to optimise zT with regard to Ltask of the success estimation σ ( hcat ) and a feasibility target ρs = 1 , such that zT = zT + η ∂Ltask ( σ ( zT ) , ρs ) ∂zT , ( 5 ) where η denotes the learning rate for the update . Finally , we apply this gradient update for S steps or until the success estimation σ ( zT ) reaches a threshold γ , and use ψ� ( zT ) to generate the imagined 3D tool mesh represented by zT .
The authors try to tackle the problem of tool synthesis by using a classifier to guide the learning and exploitation of a generative model through activation maximization. Experiments are conducted on the proposed simulated reaching dataset on tool selection and tool imagination. While the idea of synthesizing tools step by step continuously is interesting, the technical and experimental design make the problem over-simplified and thus raise some concerns.
SP:a43b09142b12e0b68e3e658a9011068615c46481
Improving Model Robustness with Latent Distribution Locally and Globally
1 INTRODUCTION . Deep Neural Networks ( DNNs ) have achieved impressive performance on a broad range of datasets , yet can be easily fooled by adversarial examples or perturbations ( LeCun et al. , 2015 ; He et al. , 2016 ; Gers et al. , 1999 ) . Adversarial examples have been shown to be ubiquitous beyond different tasks such as image classification ( Goodfellow et al. , 2014 ) , segmentation ( Fischer et al. , 2017 ) , and speech recognition ( Carlini & Wagner , 2018 ) . Overall , adversarial examples raise great concerns about the robustness of learning models , and have drawn enormous attention over recent years . To defend adversarial examples , great efforts have been made to improve the model robustness ( Kannan et al. , 2018 ; You et al. , 2019 ; Wang & Zhang , 2019 ; Zhang & Wang , 2019 ) . Most of them are based on the adversarial training , i.e . training the model with adversarially-perturbed samples rather than clean data ( Goodfellow et al. , 2014 ; Madry et al. , 2017 ; Lyu et al. , 2015 ) . In principle , adversarial training is a min-max game between the adversarial perturbations and classifier . Namely , the indistinguishable adversarial perturbations are designed to mislead the output of the classifier , while the classifier is trained to produce the accurate predictions for these perturbed input data . Currently , the adversarial perturbations are mainly computed by enforcing the output invariance in a supervised manner ( Madry et al. , 2017 ) . Despite its effectiveness in some scenarios , it is observed recently that these approaches may still be limited in defending adversarial examples . In particular , we argue that these current adversarial training approaches are typically conducted in a local and supervised way and fail to consider globally the overall data manifold information ; such information however proves crucially important for attaining better generalization . As a result , the generated adversarial examples may corrupt the underlying data structure and would be typically biased towards the decision boundary . Therefore , the well-generalizing features inherent to the data distribution might be lost , which limits the performance of the DNNs to defend adversarial examples even if adversarial training is applied ( Ilyas et al. , 2019a ; Schmidt et al. , 2018 ) . For illustration , we have shown a toy example in Figure 1 . As clearly observed , adversarially-perturbed examples gen- erated by PGD , one of the most successful adversarial training method , corrupt the data manifold , which would inevitably lead to poor performance if the training is conducted based on these perturbed examples . On the other hand , the current state-of-the-art method Feature Scattering ( Zhang & Wang , 2019 ) can partially alleviate this problem but still leads to corruptions on the data manifold . To address this limitation , we propose a novel method called Adversarial Training with Latent Distribution ( ATLD ) which additionally considers the data distribution globally in an unsupervised fashion . In this way , the data manifold could be well preserved , which is beneficial to attain better model generalization . Moreover , since the label information is not required when computing the adversarial perturbations , the resulting adversarial examples would not be biased towards the decision boundary . This can be clearly observed in Figure 1 ( d ) . Our method can be divided into two steps : first , we train the deep model with the adversarial examples which maximize the variance between latent distributions of clean data and adversarial counterpart rather than maximizing the loss function . We reformulate it as a minimax game between a discriminator and a classifier . The adversarial examples are crafted by the discriminator to make different implicitly the latent distributions of clean and perturbed data , while the classifier is trained to decrease the discrepancy between these two latent distributions as well as promoting accurate classification on the adversarial examples as Figure 2 shows . Then , during the inference procedure , we generate the specific perturbations through the discriminator network to diminish the impact of the adversarial attack as shown in Figure 6 in Appendix . On the empirical front , with the toy examples , we show that our proposed method can preserve more information of the original distribution and learn a better decision boundary than the existing adversarial training method . We also test our method on three different datasets : CIFAR-10 , CIFAR100 and SVHN with the famous PGD , CW and FGSM attacks . Our ATLD method outperforms the state-of-the-art methods by a large margin . e.g . ATLD improves over Feature Scattering ( Zhang & Wang , 2019 ) by 17.0 % and 18.1 % on SVHN for PGD20 and CW20 attacks . Our method also shows a large superiority to the conventional adversarial training method ( Madry et al. , 2017 ) , boosting the performance by 32.0 % and 30.7 % on SVHN for PGD20 and CW20 attacks . 2 RELATED WORK . Adversarial Training . Adversarial training is a family of techniques to improve the model robustness ( Madry et al. , 2017 ; Lyu et al. , 2015 ) . It trains the DNNs with adversarially-perturbed samples instead of clean data . Some approaches extend the conventional adversarial training by injecting the adversarial noise to hidden layers to boost the robustness of latent space ( Ilyas et al. , 2019b ; You et al. , 2019 ; Santurkar et al. , 2019 ; Liu et al. , 2019 ) . All of these approaches generate the adversarial examples by maximizing the loss function with the label information . However , the structure of the data distribution is destroyed since the perturbed samples could be highly biased towards the non-optimal decision boundary ( Zhang & Wang , 2019 ) . Our proposed method has a similar training scheme with adversarial training by replacing clean data with the perturbed one . Nevertheless , our method generates the adversarial perturbations without the label information which weakens the impact of non-optimal decision boundary and can retain more information of the underlying data distribution . Manifold-based Adversarial Training . Song et al . ( 2017 ) propose to generate the adversarial examples by projecting on a proper manifold . Zhang & Wang ( 2019 ) leverage the manifold information in the forms of inter-sample relationship within the batch to generate adversarial adversarial perturbations . Virtual Adversarial Training and Manifold Adversarial Training are proposed improve model generalization and robustness against adversarial examples by ensuring the local smoothness of the data distribution ( Zhang et al. , 2018 ; Miyato et al. , 2017 ) . Some methods are designed to enforce the local smoothness around the natural examples by penalizing the difference between the outputs of adversarial examples and clean counterparts ( Kannan et al. , 2018 ; Chan et al. , 2020 ; Jakubovitz & Giryes , 2018 ) . All of these methods just leverage the local information of the distribution or manifold . Differently , our method generates the perturbations additionally considering the structure of distribution globally . Unsupervised Domain Adversarial Training . Domain Adversarial Training shares a training scheme similar to our method where the classifier and discriminator compete with each other ( Odena et al. , 2017 ; Long et al. , 2018 ; Ganin et al. , 2016 ) . However , its objective is to reduce the gap between the source and target distributions in the latent space . The discriminator is used to measure the divergence between these two distributions in the latent space . The training scheme of our method is also based on competition between the classifier and discriminator . Different from the previous framework , the discriminator of our method is used to capture the information of distributions of adversarial examples and clean counterparts in the latent space which helps generate the adversarial perturbations . GAN-based Adversarial Training Methods . Several GAN-based methods leverage GANs to learn the clean data distribution and purify the adversarial examples by projecting them on clean data manifold before classification ( Meng & Chen , 2017 ; Metzen et al. , 2017 ) . The framework of GAN can also be used to generate the adversarial examples ( Baluja & Fischer , 2018 ) . The generator produces the adversarial examples to deceive both the discriminator and classifier ; the discriminator and classifier attempt to differentiate the adversaries from clean data and produce the correct labels respectively . Some adversary detector networks are proposed to detect the adversarial examples which can be well aligned with our method ( Gong et al. , 2017 ; Grosse et al. , 2017 ) . In these works , a pretrained network is augmented with a binary detector network . The training of the pretrained network and detector involves generating adversarial examples to maximize their losses . Differently , our method generates the adversarial examples just to minimize the loss of the discriminator and feed them as the training set to the classifier . Such adversarial examples are deemed to induce most different latent representations from the clean counterpart . 3 BACKGROUND . 3.1 ADVERSARIAL TRAINING . Let us first introduce the widely-adopted adversarial training method for defending against adversarial attacks . Specifically , it solves the following minimax optimization problem through training . min θ { E ( x , y ) ∼D [ max x′∈Sx L ( x′ , y ; θ ) ] } , ( 1 ) where x ∈ Rn and y ∈ R are respectively the clean data samples and the corresponding labels drawn from the dataset D , and L ( · ) is the loss function of the DNN with the model parameter θ ∈ Rm . Furthermore , we denote the clean data distribution as Q0 , i.e . x ∼ Q0 . , and denote x′ ∈ Rn as perturbed samples in a feasible region Sx , { z : z ∈ B ( x , ) ∩ [ −1.0 , 1.0 ] n } with B ( z , ) , { z : ‖x− z‖∞ ≤ } being the ` ∞-ball at center x with radius . By defining fθ ( · ) as the mapping function from the input layer to the last latent layer , we can also rewrite the loss function of the DNN as l ( fθ ( x ) , y ) where l ( · ) denotes the loss function calculated from the last hidden layer of the DNN , e.g . the cross entropy loss as typically used in DNN . Whilst the outer minimization can be conducted by training to find the optimal model parameters θ , the inner maximization essentially generates the strongest adversarial attacks on a given set of model parameters θ . In general , the solution to the minimax problem can be found by training a network minimizing the loss for worst-case adversarial examples , so as to attain adversarial robustness . Given a set of model parameters θ , the commonly adopted solution to the inner maximization problem can lead to either one-step ( e.g. , FGSM ) or multi-step ( e.g. , PGD ) approach ( Madry et al. , 2017 ) . In particular , for a given single point x , the strongest adversarial example x′ at the t-th iteration can be iteratively obtained by the following updating rule : xt+1 = ΠSx ( x t + α · sgn ( ∇xL ( xt , y ; θ ) ) ) , ( 2 ) where ΠSx ( · ) is a projection operator to project the inputs onto the region Sx , sgn ( · ) is the sign function , and α is the updating step size . For the initialization , x0 can be generated by randomly sampling in B ( x , ) . It appears in ( 1 ) that each perturbed sample x′ is obtained individually by leveraging its loss function L ( x′ , y ; θ ) with its label y . However , without considering the inter-relationship between samples , we may lose the global knowledge of the data manifold structure which proves highly useful for attaining better generalization . This issue has been studied in a recent work ( Zhang & Wang , 2019 ) where a new method named feature scattering made a first step to consider the inter-sample relationship within the batch ; unfortunately this approach did not take the full advantages of the global knowledge of the entire data distribution . In addition , relying on the maximization of the loss function , the adversarially-perturbed data samples may be highly biased towards the decision boundary , which potentially corrupts the structure of the original data distribution , especially when the decision boundary is non-optimal ( see Figure 1 again for the illustration ) .
This paper presents a framework for adversarial robustness via incorporating local and global structure of the data manifold. Specifically, the key motivation is that standard adversarial methods typically use only sample specific perturbations for generating the adversarial examples, and thus using them for robustness of the learning model is limited. Instead the paper proposes to capture the global data manifold as well in the robustifying framework. To this end, an objective is presented (4,5) that uses latent data distributions, with the goal that the adversarial perturbations should maximize the f-divergence against the latent distribution of the clean samples. Experiments are provided on several datasets and demonstrate significant performance improvements.
SP:cc0fa305b4443aa39690c404edc80ecf9c5757ae
Improving Model Robustness with Latent Distribution Locally and Globally
1 INTRODUCTION . Deep Neural Networks ( DNNs ) have achieved impressive performance on a broad range of datasets , yet can be easily fooled by adversarial examples or perturbations ( LeCun et al. , 2015 ; He et al. , 2016 ; Gers et al. , 1999 ) . Adversarial examples have been shown to be ubiquitous beyond different tasks such as image classification ( Goodfellow et al. , 2014 ) , segmentation ( Fischer et al. , 2017 ) , and speech recognition ( Carlini & Wagner , 2018 ) . Overall , adversarial examples raise great concerns about the robustness of learning models , and have drawn enormous attention over recent years . To defend adversarial examples , great efforts have been made to improve the model robustness ( Kannan et al. , 2018 ; You et al. , 2019 ; Wang & Zhang , 2019 ; Zhang & Wang , 2019 ) . Most of them are based on the adversarial training , i.e . training the model with adversarially-perturbed samples rather than clean data ( Goodfellow et al. , 2014 ; Madry et al. , 2017 ; Lyu et al. , 2015 ) . In principle , adversarial training is a min-max game between the adversarial perturbations and classifier . Namely , the indistinguishable adversarial perturbations are designed to mislead the output of the classifier , while the classifier is trained to produce the accurate predictions for these perturbed input data . Currently , the adversarial perturbations are mainly computed by enforcing the output invariance in a supervised manner ( Madry et al. , 2017 ) . Despite its effectiveness in some scenarios , it is observed recently that these approaches may still be limited in defending adversarial examples . In particular , we argue that these current adversarial training approaches are typically conducted in a local and supervised way and fail to consider globally the overall data manifold information ; such information however proves crucially important for attaining better generalization . As a result , the generated adversarial examples may corrupt the underlying data structure and would be typically biased towards the decision boundary . Therefore , the well-generalizing features inherent to the data distribution might be lost , which limits the performance of the DNNs to defend adversarial examples even if adversarial training is applied ( Ilyas et al. , 2019a ; Schmidt et al. , 2018 ) . For illustration , we have shown a toy example in Figure 1 . As clearly observed , adversarially-perturbed examples gen- erated by PGD , one of the most successful adversarial training method , corrupt the data manifold , which would inevitably lead to poor performance if the training is conducted based on these perturbed examples . On the other hand , the current state-of-the-art method Feature Scattering ( Zhang & Wang , 2019 ) can partially alleviate this problem but still leads to corruptions on the data manifold . To address this limitation , we propose a novel method called Adversarial Training with Latent Distribution ( ATLD ) which additionally considers the data distribution globally in an unsupervised fashion . In this way , the data manifold could be well preserved , which is beneficial to attain better model generalization . Moreover , since the label information is not required when computing the adversarial perturbations , the resulting adversarial examples would not be biased towards the decision boundary . This can be clearly observed in Figure 1 ( d ) . Our method can be divided into two steps : first , we train the deep model with the adversarial examples which maximize the variance between latent distributions of clean data and adversarial counterpart rather than maximizing the loss function . We reformulate it as a minimax game between a discriminator and a classifier . The adversarial examples are crafted by the discriminator to make different implicitly the latent distributions of clean and perturbed data , while the classifier is trained to decrease the discrepancy between these two latent distributions as well as promoting accurate classification on the adversarial examples as Figure 2 shows . Then , during the inference procedure , we generate the specific perturbations through the discriminator network to diminish the impact of the adversarial attack as shown in Figure 6 in Appendix . On the empirical front , with the toy examples , we show that our proposed method can preserve more information of the original distribution and learn a better decision boundary than the existing adversarial training method . We also test our method on three different datasets : CIFAR-10 , CIFAR100 and SVHN with the famous PGD , CW and FGSM attacks . Our ATLD method outperforms the state-of-the-art methods by a large margin . e.g . ATLD improves over Feature Scattering ( Zhang & Wang , 2019 ) by 17.0 % and 18.1 % on SVHN for PGD20 and CW20 attacks . Our method also shows a large superiority to the conventional adversarial training method ( Madry et al. , 2017 ) , boosting the performance by 32.0 % and 30.7 % on SVHN for PGD20 and CW20 attacks . 2 RELATED WORK . Adversarial Training . Adversarial training is a family of techniques to improve the model robustness ( Madry et al. , 2017 ; Lyu et al. , 2015 ) . It trains the DNNs with adversarially-perturbed samples instead of clean data . Some approaches extend the conventional adversarial training by injecting the adversarial noise to hidden layers to boost the robustness of latent space ( Ilyas et al. , 2019b ; You et al. , 2019 ; Santurkar et al. , 2019 ; Liu et al. , 2019 ) . All of these approaches generate the adversarial examples by maximizing the loss function with the label information . However , the structure of the data distribution is destroyed since the perturbed samples could be highly biased towards the non-optimal decision boundary ( Zhang & Wang , 2019 ) . Our proposed method has a similar training scheme with adversarial training by replacing clean data with the perturbed one . Nevertheless , our method generates the adversarial perturbations without the label information which weakens the impact of non-optimal decision boundary and can retain more information of the underlying data distribution . Manifold-based Adversarial Training . Song et al . ( 2017 ) propose to generate the adversarial examples by projecting on a proper manifold . Zhang & Wang ( 2019 ) leverage the manifold information in the forms of inter-sample relationship within the batch to generate adversarial adversarial perturbations . Virtual Adversarial Training and Manifold Adversarial Training are proposed improve model generalization and robustness against adversarial examples by ensuring the local smoothness of the data distribution ( Zhang et al. , 2018 ; Miyato et al. , 2017 ) . Some methods are designed to enforce the local smoothness around the natural examples by penalizing the difference between the outputs of adversarial examples and clean counterparts ( Kannan et al. , 2018 ; Chan et al. , 2020 ; Jakubovitz & Giryes , 2018 ) . All of these methods just leverage the local information of the distribution or manifold . Differently , our method generates the perturbations additionally considering the structure of distribution globally . Unsupervised Domain Adversarial Training . Domain Adversarial Training shares a training scheme similar to our method where the classifier and discriminator compete with each other ( Odena et al. , 2017 ; Long et al. , 2018 ; Ganin et al. , 2016 ) . However , its objective is to reduce the gap between the source and target distributions in the latent space . The discriminator is used to measure the divergence between these two distributions in the latent space . The training scheme of our method is also based on competition between the classifier and discriminator . Different from the previous framework , the discriminator of our method is used to capture the information of distributions of adversarial examples and clean counterparts in the latent space which helps generate the adversarial perturbations . GAN-based Adversarial Training Methods . Several GAN-based methods leverage GANs to learn the clean data distribution and purify the adversarial examples by projecting them on clean data manifold before classification ( Meng & Chen , 2017 ; Metzen et al. , 2017 ) . The framework of GAN can also be used to generate the adversarial examples ( Baluja & Fischer , 2018 ) . The generator produces the adversarial examples to deceive both the discriminator and classifier ; the discriminator and classifier attempt to differentiate the adversaries from clean data and produce the correct labels respectively . Some adversary detector networks are proposed to detect the adversarial examples which can be well aligned with our method ( Gong et al. , 2017 ; Grosse et al. , 2017 ) . In these works , a pretrained network is augmented with a binary detector network . The training of the pretrained network and detector involves generating adversarial examples to maximize their losses . Differently , our method generates the adversarial examples just to minimize the loss of the discriminator and feed them as the training set to the classifier . Such adversarial examples are deemed to induce most different latent representations from the clean counterpart . 3 BACKGROUND . 3.1 ADVERSARIAL TRAINING . Let us first introduce the widely-adopted adversarial training method for defending against adversarial attacks . Specifically , it solves the following minimax optimization problem through training . min θ { E ( x , y ) ∼D [ max x′∈Sx L ( x′ , y ; θ ) ] } , ( 1 ) where x ∈ Rn and y ∈ R are respectively the clean data samples and the corresponding labels drawn from the dataset D , and L ( · ) is the loss function of the DNN with the model parameter θ ∈ Rm . Furthermore , we denote the clean data distribution as Q0 , i.e . x ∼ Q0 . , and denote x′ ∈ Rn as perturbed samples in a feasible region Sx , { z : z ∈ B ( x , ) ∩ [ −1.0 , 1.0 ] n } with B ( z , ) , { z : ‖x− z‖∞ ≤ } being the ` ∞-ball at center x with radius . By defining fθ ( · ) as the mapping function from the input layer to the last latent layer , we can also rewrite the loss function of the DNN as l ( fθ ( x ) , y ) where l ( · ) denotes the loss function calculated from the last hidden layer of the DNN , e.g . the cross entropy loss as typically used in DNN . Whilst the outer minimization can be conducted by training to find the optimal model parameters θ , the inner maximization essentially generates the strongest adversarial attacks on a given set of model parameters θ . In general , the solution to the minimax problem can be found by training a network minimizing the loss for worst-case adversarial examples , so as to attain adversarial robustness . Given a set of model parameters θ , the commonly adopted solution to the inner maximization problem can lead to either one-step ( e.g. , FGSM ) or multi-step ( e.g. , PGD ) approach ( Madry et al. , 2017 ) . In particular , for a given single point x , the strongest adversarial example x′ at the t-th iteration can be iteratively obtained by the following updating rule : xt+1 = ΠSx ( x t + α · sgn ( ∇xL ( xt , y ; θ ) ) ) , ( 2 ) where ΠSx ( · ) is a projection operator to project the inputs onto the region Sx , sgn ( · ) is the sign function , and α is the updating step size . For the initialization , x0 can be generated by randomly sampling in B ( x , ) . It appears in ( 1 ) that each perturbed sample x′ is obtained individually by leveraging its loss function L ( x′ , y ; θ ) with its label y . However , without considering the inter-relationship between samples , we may lose the global knowledge of the data manifold structure which proves highly useful for attaining better generalization . This issue has been studied in a recent work ( Zhang & Wang , 2019 ) where a new method named feature scattering made a first step to consider the inter-sample relationship within the batch ; unfortunately this approach did not take the full advantages of the global knowledge of the entire data distribution . In addition , relying on the maximization of the loss function , the adversarially-perturbed data samples may be highly biased towards the decision boundary , which potentially corrupts the structure of the original data distribution , especially when the decision boundary is non-optimal ( see Figure 1 again for the illustration ) .
The paper analyzes the property of local and global data manifold for adversarial training. In particular, they used a discriminator-classifier model, where the discriminator tries to differentiate between the natural and adversarial space, and the classifier aims to classify between them while maintaining the constraints between local and global distributions. The authors implemented the proposed method on several datasets and achieved good performance. They also compared with several whitebox and blackbox methods and proved superiority.
SP:cc0fa305b4443aa39690c404edc80ecf9c5757ae
Learning explanations that are hard to vary
1 INTRODUCTION Consider the top of Figure 1 , which shows a view from above of the loss surface obtained as we vary a two dimensional parameter vector θ “ pθ1 , θ2q , for a fictional dataset containing two observations xA and xB . Note the two global minima on the top-right and bottom-left . Depending on the initial values of θ — marked as white circles — gradient descent converges to one of the two minima . Judging solely by the value of the loss function , which is zero in both cases , the two minima look equally good . However , looking at the loss surfaces for xA and xB separately , as shown below , a crucial difference between those two minima appears : Starting from the same initial parameter configurations and following the gradient of the loss , ∇θLpθ , xiq , the probability of finding the same minimum on the top-right in either case is zero . In contrast , the minimum in the lower-left corner has a significant overlap across the two loss surfaces , so gradient descent can converge to it even if training on xA ( or xB ) only . Note that after averaging there is no way to tell what the two loss surfaces looked like : Are we destroying information that is potentially important ? In this paper , we argue that the answer is yes . In particular , we hypothesize that if the goal is to find invariant mechanisms in the data , these can be identified by finding explanations ( e.g . model parameters ) that are hard to vary across examples . A notion of invariance implies something that stays the same , as something else changes . We assume that data comes from different environments : An invariant mechanism is shared across all , generalizes out of distribution ( o.o.d . ) , but might be hard to model ; each environment also has spurious explanations that are easy to spot ( ‘ shortcuts ’ ) , but do not generalize o.o.d . From the point of view of causal modeling , such invariant mechanisms can be interpreted as conditional distributions of the targets given causal features of the inputs ; invariance of such conditionals is expected if they represent causal mechanisms , that is — stable properties of the physical world ( see e.g . Hoover ( 1990 ) ) . Generalizing o.o.d . means therefore that the predictor should perform equally well on data coming from different settings , as long as they share the causal mechanisms . We formalize a notion of consistency , which characterizes to what extent a minimum of the loss surface appears only when data from different environments are pooled . Minima with low consistency are ‘ patchwork ’ solutions , which ( we hypothesize ) sew together different strategies and should not be expected to generalize to new environments . An intuitive description of this principle was proposed by physicist David Deutsch : “ good explanations are hard to vary ” ( Deutsch , 2011 ) . Using the notion of consistency , we define Invariant Learning Consistency ( ILC ) , a measure of the expected consistency of the solution found by a learning algorithm on a given hypothesis class . The ILC can be improved by changing the hypothesis class or the learning algorithm , and in the last part of the paper we focus on the latter . We then analyse why current practices in deep learning provide little incentive for networks to learn invariances , and show that standard training is instead set up with the explicit objective of greedily maximizing speed of learning , i.e. , progress on the training loss . When learning “ as fast as possible ” is not the main objective , we show we can trade-off some “ learning speed ” for prioritizing learning the invariances . A practical instantiation of ILC leads to o.o.d . generalization on a challenging synthetic task where several established regularizers fail to generalize ; moreover , following the memorization task from Zhang et al . ( 2017 ) , ILC prevents convergence on CIFAR-10 with random labels , as no shared mechanism is present , and similarly when a portion of training labels is incorrect . Lastly , we set up a behavioural cloning task based on the game CoinRun ( Cobbe et al. , 2019b ) , and observe better generalization on new unseen levels . 5334 Problems , Combinat ions & Games 1.1 Mate in 1 295 80Z0Z0Z0Z 7Z0Z0ZpZ0 6pZ0Z0ZpZ 5jpZ0ZPZ0 40Z0ZnZPA 3OPZ0Z0Z0 20ZKZ0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 296 80Z0Z0Z0Z 7snZ0Z0o0 60j0Z0ZPZ 5o0ZPZ0Z0 4Po0Z0M0Z 3ZKZ0Z0Z0 20ZRZ0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 297 80Z0Z0Z0Z 7Z0Zns0Z0 6BZ0ako0Z 5Z0Z0o0Z0 40O0Z0ZPZ 3Z0Z0Z0Z0 20ZKZNZ0Z 1Z0Z0Z0ZR a b c d e f g h 298 80Z0Z0Z0Z 7ZRZ0Z0Z0 60Z0ako0Z 5Z0Z0onZ0 40Z0oKZPZ 3Z0ZPZ0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 299 8rZ0l0j0s 7opZ0a0op 60Z0o0m0Z 5Z0Z0o0M0 40Z0ZPZbZ 3OQM0A0Z0 20O0Z0OPO 1Z0ZRS0J0 a b c d e f g h 300 80ZrZ0j0s 7obl0opZp 60onZ0M0Z 5Z0m0Z0A0 40Z0o0Z0Z 3ZPZPZPO0 2PZ0MQZ0O 1ZKZ0S0ZR a b c d e f g h 5334 Problems , Combinat ions & Games 1.1 Mate in 1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 a b c d e f g h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZQZ0 20J0Z0Z0Z 1Z0Z0l0Z0 a b c d e f g h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 a b c d e f g h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 a b c d e f g h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR a b c d e f g h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0ZBZ0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZkZNZ0Z 7oRZRZ0Z0 6KZ0Z0Z0Z 5Z0Z0ZnZ0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 422 80Z0Z0Z0Z 7ZNZ0Z0Z0 6RZpZ0Z0Z 5ZkZ0Z0Z0 40MpZ0Z0Z 3Z0J0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 423 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0ZNZB 40Z0Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ0Z 1Z0Z0Z0J0 a b c d e f g h 424 80Z0Z0Z0Z 7Z0o0Z0S0 60ZRZNZ0j 5Z0Z0Z0Z0 40Z0Z0Z0o 3Z0Z0Z0ZK 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 425 80Z0Z0Z0Z 7Z0Z0Z0Zp 60Z0Z0Z0L 5Z0Z0Z0Z0 40Z0ZKZko 3Z0Z0Z0Z0 20Z0Z0ZPZ 1Z0Z0ZNZ0 a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0Z 5ZkZpZ0Z0 40Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 355 8 7 0 60 0 5 0 Q 4 Z mB 3 A j 2 1 K a b c d e f g h 356 8 Z0 0Z0Z 7 Z 0Z0 60Z Z Z0Z 5Z0Z0 0Z0 40Z0o0ZNZ 3Z0ZKZ0Z0 20Z0Z0ZpL 1Z0Z0ZkZ0 a b c d e f g h 357 80Z0Z0ZRZ 7Z0Z0ZKm0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0S0 20Z0Z0Z0Z 1Z0Z0Z0Ak a b c d e f g h 358 8 ZKZ0Z 7 0Z0Z0 6 p kZ0Z 5 O0Z0 4 OQZ0Z 3 Z0Z0 2 0Z0Z 1 Z0Z0 a b c d e f g h 359 80Z0Z0Z0Z 7jPO0Z0Z0 60SnZ0Z0Z 5Z0J0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 360 80Z0Z0ArZ 7Z0Z0Z0O0 60Z0Z0JBj 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZkZN 7oRZR 6KZ0Z 5Z0Z0 n 40Z0Z 0 3Z0Z0 Z 20Z0Z 1Z0Z0 a b c d e f g h 422 80Z0Z 7ZNZ0 6RZpZ 5ZkZ0 40MpZ 3Z0J0 20Z0Z 1Z0Z0 a b c d e f g h 423 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0ZNZB 40Z0Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ0Z 1Z0Z0Z0J0 a b c d e f g h 424 8 0Z 7 o0 S 6 RZN j 5 Z0 4 0Z o 3 Z0 K 2 0Z 1 Z0 a b c d e f g h 425 8 0Z 7 Z0 p 6 0Z Z L 5 0Z0 0 0 4 0ZK ko 3Z0Z0 Z 2 0Z0 P 1Z Z0 N a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0Z 5ZkZpZ0Z0 40Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h Rc7 Qc5 5334 Problems , Combinat ions & Games 1.1 Mate in 1 295 80Z0Z0Z0Z 7Z0Z0 p 0 6pZ0 0Z 5jpZ0 P 0 40Z0 nZPA 3OPZ Z0 20ZKZ Z 1Z0Z a b c d e f g h 296 80Z0Z0Z0Z 7snZ o0 60j0 PZ 5o0ZP Z 4Po0 M 3ZKZ 20ZR 1Z0Z Z a b c d e f g h 297 80Z0Z0Z0Z 7Z0Zns 0 6BZ0ako 5Z0Z o 40O0 P 3Z0Z 20ZK N 1Z0Z R a b c d e f g h 298 80Z0Z0Z0Z 7ZRZ 60Z0ako 5 0Z0 n 4 Z0oK P 3 0ZPZ 0 20Z0 Z 1 0Z0 a b c d e f g h 299 8rZ0l0j0s 7opZ a op 6 Z0o m 5 0Z o M 4 Z0 P b 3OQM A 2 O0 OPO 1 0ZRS0J a b c d e f g h 300 80ZrZ0j0s 7obl0op p 6 onZ M 5 0m0 0A 4 Z0o0Z 3 PZP PO 2PZ0MQ O 1ZKZ S R a b c d e f g h 5334 Problems , Combinat ions & Games 1.1 Mate in 1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 a b c d e f g h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZQZ0 20J0Z0Z0Z 1Z0Z0l0Z0 a b c d e f g h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 a b c d e f g h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 a b c d e f g h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR a b c d e f g h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0ZBZ0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 355 8 0Z0Z0Z 7Z Z0Z0Z0 6 Z0Z0Z0Z 5 Z0ZQZ0 4 Z0Z0mBZ 3 0A0j0Z0 2 0Z0Z0Z 1 Z0ZKZ0 a b c d e f g h 356 8 0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0o0ZNZ 3Z0ZKZ0Z0 20Z0Z0ZpL 1Z0Z0ZkZ0 a b c d e f g h 357 80Z0Z0ZRZ 7Z0Z0ZKm0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0S0 20Z0Z0Z0Z 1Z0Z0Z0Ak a b c d e f g h 358 80Z0ZKZ0Z 7Z0Z0Z0Z0 60ZpZkZ0Z 5Z0Z0O0Z0 40Z0OQZ0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 359 80Z0Z0Z0Z 7jPO0Z0Z0 60SnZ0Z0Z 5Z0J0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 360 80Z0Z0ArZ 7Z0Z0Z0O0 60Z0Z0JBj 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h Kg2 5334Problems , Combinations & Games 1.1Matein1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 abcdefg h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z00Z0 4Z0Z 3QZ0 2J0Z 1lZ0 abcdefg h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 abcdefg h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 abcdefg h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR abcdefg h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z 3Z0Z0Z0 20Z0Z0Z 1Z0Z0ZB abcdefg h Bf8 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZk N 7oRZR 6KZ0 5 0Z n 4 Z0 3Z0Z0Z0Z0 20Z0Z0Z0Z 1 a b c d e f g h 422 8 7 N 0 6R p 5 k 4 Mp 3Z0J0Z0Z0 20Z0Z0Z0Z 1 a b c d e f g h 423 8 7 Z 6 5 N B 4 3Z0Z0o0ok 20Z0ZRZ0Z 1 J0 a b c d e f g h 424 8 0 Z 7 o Z0S0 6 ZRZN j 5 0 4 0 o 3Z0Z0Z0ZK 20Z0Z0Z0Z 1 0 a b c d e f g h 425 8 Z0Z0Z0Z 7Z0Z0Z0Zp 6 Z0Z0Z0L 5 0Z0Z0Z0 4 Z0ZKZko 3Z0Z0Z0Z0 20Z0Z0ZPZ 1 0Z0ZNZ0 a b c d e f g h 426 8 Z0Z0Z0Z 7 0ZRZ0Z0 6 o0Z0Z0Z 5 kZpZ0Z0 4 Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Com binations & Games 2.1 White to Move # 2 421 8r k N 0Z 7oR RZ Z0 6K 0 0Z 5 0 nZ0 4 Z 0Z 3 Z0 20 0Z 1 Z0 a b c d e f g h 422 8 0Z 7 NZ Z0 6RZpZ 0Z 5 kZ Z0 4 Mp 0 0Z 3 J Z0 20 0 0Z 1 0Z0 a b c d e f g h 423 80Z0Z0Z 7Z0Z0Z0 60Z0Z0Z 5Z0Z0ZN B 40Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ 1Z0Z0Z0J a b c d e f g h 424 8 Z Z Z0Z 7 o Z0S0 6 ZRZN 0j 5 Z Z Z0 4 0 0o 3Z ZK 2 Z 1 0Z a b c d e f g h 425 80 Z Z0Z 7Z p 60 L 5Z 4 Z K ko 3 0 0Z Z0 2 Z0 ZPZ 1 Z NZ0 a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0 5ZkZpZ0Z 40Z0O0 3Z0J0Z 2QZ0Z 1Z0Z0Z0Z a b c d e f g h An example . Take these two second-hand books of chess puzzles . We can learn the two independent shortcuts ( blue arrows for the left book OR handwritten solutions on the right ) , or actually learn to play chess ( the invariant mechanism ) . While both strategies solve other problems from the same books ( i.i.d . ) , only the latter generalises to new chess puzzle books ( o.o.d. ) . How to distingui h the two ? We would not have learned about the red arrows had we trained on the book on the right , and vice versa with the hand-written notes .
this work posits that invariant mechanisms exist in a dataset. a machine learning algorithm that is trained using gradient descent usually averages gradients across examples. the thesis is that by averaging gradients, information is lost. the method posits that in a gradient descent algorithm, instead of an arithmetic average, a geometric (or karcher) mean can be used to preserve information about invariant mechanisms - while ignoring confounders. there are difficulties in a straightforward application of the geometric mean, so a simple heuristic algorithm is developed, involving masking gradients depending on whether the sign of the gradient agrees across a batch of examples (or, whether some agreement threshold is reached). this algorithm is tested on a synthetic dataset, a semi-synthetic task on CIFAR-10, and coinbase, an RL algorithm.
SP:7db5acb622d42134949e6aa08fbcf0c4d40bf83c
Learning explanations that are hard to vary
1 INTRODUCTION Consider the top of Figure 1 , which shows a view from above of the loss surface obtained as we vary a two dimensional parameter vector θ “ pθ1 , θ2q , for a fictional dataset containing two observations xA and xB . Note the two global minima on the top-right and bottom-left . Depending on the initial values of θ — marked as white circles — gradient descent converges to one of the two minima . Judging solely by the value of the loss function , which is zero in both cases , the two minima look equally good . However , looking at the loss surfaces for xA and xB separately , as shown below , a crucial difference between those two minima appears : Starting from the same initial parameter configurations and following the gradient of the loss , ∇θLpθ , xiq , the probability of finding the same minimum on the top-right in either case is zero . In contrast , the minimum in the lower-left corner has a significant overlap across the two loss surfaces , so gradient descent can converge to it even if training on xA ( or xB ) only . Note that after averaging there is no way to tell what the two loss surfaces looked like : Are we destroying information that is potentially important ? In this paper , we argue that the answer is yes . In particular , we hypothesize that if the goal is to find invariant mechanisms in the data , these can be identified by finding explanations ( e.g . model parameters ) that are hard to vary across examples . A notion of invariance implies something that stays the same , as something else changes . We assume that data comes from different environments : An invariant mechanism is shared across all , generalizes out of distribution ( o.o.d . ) , but might be hard to model ; each environment also has spurious explanations that are easy to spot ( ‘ shortcuts ’ ) , but do not generalize o.o.d . From the point of view of causal modeling , such invariant mechanisms can be interpreted as conditional distributions of the targets given causal features of the inputs ; invariance of such conditionals is expected if they represent causal mechanisms , that is — stable properties of the physical world ( see e.g . Hoover ( 1990 ) ) . Generalizing o.o.d . means therefore that the predictor should perform equally well on data coming from different settings , as long as they share the causal mechanisms . We formalize a notion of consistency , which characterizes to what extent a minimum of the loss surface appears only when data from different environments are pooled . Minima with low consistency are ‘ patchwork ’ solutions , which ( we hypothesize ) sew together different strategies and should not be expected to generalize to new environments . An intuitive description of this principle was proposed by physicist David Deutsch : “ good explanations are hard to vary ” ( Deutsch , 2011 ) . Using the notion of consistency , we define Invariant Learning Consistency ( ILC ) , a measure of the expected consistency of the solution found by a learning algorithm on a given hypothesis class . The ILC can be improved by changing the hypothesis class or the learning algorithm , and in the last part of the paper we focus on the latter . We then analyse why current practices in deep learning provide little incentive for networks to learn invariances , and show that standard training is instead set up with the explicit objective of greedily maximizing speed of learning , i.e. , progress on the training loss . When learning “ as fast as possible ” is not the main objective , we show we can trade-off some “ learning speed ” for prioritizing learning the invariances . A practical instantiation of ILC leads to o.o.d . generalization on a challenging synthetic task where several established regularizers fail to generalize ; moreover , following the memorization task from Zhang et al . ( 2017 ) , ILC prevents convergence on CIFAR-10 with random labels , as no shared mechanism is present , and similarly when a portion of training labels is incorrect . Lastly , we set up a behavioural cloning task based on the game CoinRun ( Cobbe et al. , 2019b ) , and observe better generalization on new unseen levels . 5334 Problems , Combinat ions & Games 1.1 Mate in 1 295 80Z0Z0Z0Z 7Z0Z0ZpZ0 6pZ0Z0ZpZ 5jpZ0ZPZ0 40Z0ZnZPA 3OPZ0Z0Z0 20ZKZ0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 296 80Z0Z0Z0Z 7snZ0Z0o0 60j0Z0ZPZ 5o0ZPZ0Z0 4Po0Z0M0Z 3ZKZ0Z0Z0 20ZRZ0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 297 80Z0Z0Z0Z 7Z0Zns0Z0 6BZ0ako0Z 5Z0Z0o0Z0 40O0Z0ZPZ 3Z0Z0Z0Z0 20ZKZNZ0Z 1Z0Z0Z0ZR a b c d e f g h 298 80Z0Z0Z0Z 7ZRZ0Z0Z0 60Z0ako0Z 5Z0Z0onZ0 40Z0oKZPZ 3Z0ZPZ0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 299 8rZ0l0j0s 7opZ0a0op 60Z0o0m0Z 5Z0Z0o0M0 40Z0ZPZbZ 3OQM0A0Z0 20O0Z0OPO 1Z0ZRS0J0 a b c d e f g h 300 80ZrZ0j0s 7obl0opZp 60onZ0M0Z 5Z0m0Z0A0 40Z0o0Z0Z 3ZPZPZPO0 2PZ0MQZ0O 1ZKZ0S0ZR a b c d e f g h 5334 Problems , Combinat ions & Games 1.1 Mate in 1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 a b c d e f g h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZQZ0 20J0Z0Z0Z 1Z0Z0l0Z0 a b c d e f g h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 a b c d e f g h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 a b c d e f g h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR a b c d e f g h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0ZBZ0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZkZNZ0Z 7oRZRZ0Z0 6KZ0Z0Z0Z 5Z0Z0ZnZ0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 422 80Z0Z0Z0Z 7ZNZ0Z0Z0 6RZpZ0Z0Z 5ZkZ0Z0Z0 40MpZ0Z0Z 3Z0J0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 423 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0ZNZB 40Z0Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ0Z 1Z0Z0Z0J0 a b c d e f g h 424 80Z0Z0Z0Z 7Z0o0Z0S0 60ZRZNZ0j 5Z0Z0Z0Z0 40Z0Z0Z0o 3Z0Z0Z0ZK 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 425 80Z0Z0Z0Z 7Z0Z0Z0Zp 60Z0Z0Z0L 5Z0Z0Z0Z0 40Z0ZKZko 3Z0Z0Z0Z0 20Z0Z0ZPZ 1Z0Z0ZNZ0 a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0Z 5ZkZpZ0Z0 40Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 355 8 7 0 60 0 5 0 Q 4 Z mB 3 A j 2 1 K a b c d e f g h 356 8 Z0 0Z0Z 7 Z 0Z0 60Z Z Z0Z 5Z0Z0 0Z0 40Z0o0ZNZ 3Z0ZKZ0Z0 20Z0Z0ZpL 1Z0Z0ZkZ0 a b c d e f g h 357 80Z0Z0ZRZ 7Z0Z0ZKm0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0S0 20Z0Z0Z0Z 1Z0Z0Z0Ak a b c d e f g h 358 8 ZKZ0Z 7 0Z0Z0 6 p kZ0Z 5 O0Z0 4 OQZ0Z 3 Z0Z0 2 0Z0Z 1 Z0Z0 a b c d e f g h 359 80Z0Z0Z0Z 7jPO0Z0Z0 60SnZ0Z0Z 5Z0J0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 360 80Z0Z0ArZ 7Z0Z0Z0O0 60Z0Z0JBj 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZkZN 7oRZR 6KZ0Z 5Z0Z0 n 40Z0Z 0 3Z0Z0 Z 20Z0Z 1Z0Z0 a b c d e f g h 422 80Z0Z 7ZNZ0 6RZpZ 5ZkZ0 40MpZ 3Z0J0 20Z0Z 1Z0Z0 a b c d e f g h 423 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0ZNZB 40Z0Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ0Z 1Z0Z0Z0J0 a b c d e f g h 424 8 0Z 7 o0 S 6 RZN j 5 Z0 4 0Z o 3 Z0 K 2 0Z 1 Z0 a b c d e f g h 425 8 0Z 7 Z0 p 6 0Z Z L 5 0Z0 0 0 4 0ZK ko 3Z0Z0 Z 2 0Z0 P 1Z Z0 N a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0Z 5ZkZpZ0Z0 40Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h Rc7 Qc5 5334 Problems , Combinat ions & Games 1.1 Mate in 1 295 80Z0Z0Z0Z 7Z0Z0 p 0 6pZ0 0Z 5jpZ0 P 0 40Z0 nZPA 3OPZ Z0 20ZKZ Z 1Z0Z a b c d e f g h 296 80Z0Z0Z0Z 7snZ o0 60j0 PZ 5o0ZP Z 4Po0 M 3ZKZ 20ZR 1Z0Z Z a b c d e f g h 297 80Z0Z0Z0Z 7Z0Zns 0 6BZ0ako 5Z0Z o 40O0 P 3Z0Z 20ZK N 1Z0Z R a b c d e f g h 298 80Z0Z0Z0Z 7ZRZ 60Z0ako 5 0Z0 n 4 Z0oK P 3 0ZPZ 0 20Z0 Z 1 0Z0 a b c d e f g h 299 8rZ0l0j0s 7opZ a op 6 Z0o m 5 0Z o M 4 Z0 P b 3OQM A 2 O0 OPO 1 0ZRS0J a b c d e f g h 300 80ZrZ0j0s 7obl0op p 6 onZ M 5 0m0 0A 4 Z0o0Z 3 PZP PO 2PZ0MQ O 1ZKZ S R a b c d e f g h 5334 Problems , Combinat ions & Games 1.1 Mate in 1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 a b c d e f g h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZQZ0 20J0Z0Z0Z 1Z0Z0l0Z0 a b c d e f g h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 a b c d e f g h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 a b c d e f g h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR a b c d e f g h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0ZBZ0 a b c d e f g h 5334 Problems , Combinations & Games 2.1 White to Move # 2 355 8 0Z0Z0Z 7Z Z0Z0Z0 6 Z0Z0Z0Z 5 Z0ZQZ0 4 Z0Z0mBZ 3 0A0j0Z0 2 0Z0Z0Z 1 Z0ZKZ0 a b c d e f g h 356 8 0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0o0ZNZ 3Z0ZKZ0Z0 20Z0Z0ZpL 1Z0Z0ZkZ0 a b c d e f g h 357 80Z0Z0ZRZ 7Z0Z0ZKm0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0S0 20Z0Z0Z0Z 1Z0Z0Z0Ak a b c d e f g h 358 80Z0ZKZ0Z 7Z0Z0Z0Z0 60ZpZkZ0Z 5Z0Z0O0Z0 40Z0OQZ0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 359 80Z0Z0Z0Z 7jPO0Z0Z0 60SnZ0Z0Z 5Z0J0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 360 80Z0Z0ArZ 7Z0Z0Z0O0 60Z0Z0JBj 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0Z0Z0 20Z0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h Kg2 5334Problems , Combinations & Games 1.1Matein1 301 8rZbZkZ0s 7ZpopZ0Zp 6pZ0ZpL0Z 5ZNO0Z0Z0 40OKZ0Z0Z 3O0Z0OnZP 20Z0Z0O0Z 1Z0Z0Z0Z0 abcdefg h 302 80Z0ZkZ0Z 7Z0Z0OpZ0 60Z0O0Z0Z 5Z0Z00Z0 4Z0Z 3QZ0 2J0Z 1lZ0 abcdefg h 303 80Z0ZkZ0Z 7Z0Z0Z0Z0 60Z0Z0ONZ 5Z0ZQZ0Z0 40Z0Z0Z0Z 3Z0Z0ZpZ0 20Z0ZnZ0J 1Z0Z0ZqZ0 abcdefg h 304 80Z0Z0s0Z 7j0Z0Z0Z0 6No0Z0Z0Z 5Z0Z0Z0Zp 40O0ZbZpO 3Z0Z0OrZ0 2RZ0Z0OKA 1Z0Z0Z0Z0 abcdefg h 305 80Z0Z0Z0Z 7Z0Z0Z0Z0 60Z0Z0Z0Z 5Z0Z0Z0Z0 40Z0Z0Z0Z 3Z0Z0ZNZ0 20orZ0ZPO 1s0j0J0ZR abcdefg h 306 8ra0Z0Z0Z 7j0o0Z0ZR 6PZPZ0Z0Z 5OpJ0Z0Z0 40Z0Z0Z 3Z0Z0Z0 20Z0Z0Z 1Z0Z0ZB abcdefg h Bf8 5334 Problems , Combinations & Games 2.1 White to Move # 2 421 8rZk N 7oRZR 6KZ0 5 0Z n 4 Z0 3Z0Z0Z0Z0 20Z0Z0Z0Z 1 a b c d e f g h 422 8 7 N 0 6R p 5 k 4 Mp 3Z0J0Z0Z0 20Z0Z0Z0Z 1 a b c d e f g h 423 8 7 Z 6 5 N B 4 3Z0Z0o0ok 20Z0ZRZ0Z 1 J0 a b c d e f g h 424 8 0 Z 7 o Z0S0 6 ZRZN j 5 0 4 0 o 3Z0Z0Z0ZK 20Z0Z0Z0Z 1 0 a b c d e f g h 425 8 Z0Z0Z0Z 7Z0Z0Z0Zp 6 Z0Z0Z0L 5 0Z0Z0Z0 4 Z0ZKZko 3Z0Z0Z0Z0 20Z0Z0ZPZ 1 0Z0ZNZ0 a b c d e f g h 426 8 Z0Z0Z0Z 7 0ZRZ0Z0 6 o0Z0Z0Z 5 kZpZ0Z0 4 Z0O0Z0Z 3Z0J0Z0Z0 2QZ0Z0Z0Z 1Z0Z0Z0Z0 a b c d e f g h 5334 Problems , Com binations & Games 2.1 White to Move # 2 421 8r k N 0Z 7oR RZ Z0 6K 0 0Z 5 0 nZ0 4 Z 0Z 3 Z0 20 0Z 1 Z0 a b c d e f g h 422 8 0Z 7 NZ Z0 6RZpZ 0Z 5 kZ Z0 4 Mp 0 0Z 3 J Z0 20 0 0Z 1 0Z0 a b c d e f g h 423 80Z0Z0Z 7Z0Z0Z0 60Z0Z0Z 5Z0Z0ZN B 40Z0Z0Z 3Z0Z0o0ok 20Z0ZRZ 1Z0Z0Z0J a b c d e f g h 424 8 Z Z Z0Z 7 o Z0S0 6 ZRZN 0j 5 Z Z Z0 4 0 0o 3Z ZK 2 Z 1 0Z a b c d e f g h 425 80 Z Z0Z 7Z p 60 L 5Z 4 Z K ko 3 0 0Z Z0 2 Z0 ZPZ 1 Z NZ0 a b c d e f g h 426 80Z0Z0Z0Z 7Z0ZRZ0Z0 60o0Z0Z0 5ZkZpZ0Z 40Z0O0 3Z0J0Z 2QZ0Z 1Z0Z0Z0Z a b c d e f g h An example . Take these two second-hand books of chess puzzles . We can learn the two independent shortcuts ( blue arrows for the left book OR handwritten solutions on the right ) , or actually learn to play chess ( the invariant mechanism ) . While both strategies solve other problems from the same books ( i.i.d . ) , only the latter generalises to new chess puzzle books ( o.o.d. ) . How to distingui h the two ? We would not have learned about the red arrows had we trained on the book on the right , and vice versa with the hand-written notes .
The authors introduce and formalize the concept of Invariant Learning Consistency (ICL), which is motivated by the idea that "good explanations are hard to vary" in the context of deep learning. Instead of using the arithmetic mean to pool gradients (logical OR), the authors propose to use the element-wise geometric mean of gradients with a logical AND masking. Experimental results on both synthetic and real-world data sets are reported under the setup of supervised learning and reinforcement learning.
SP:7db5acb622d42134949e6aa08fbcf0c4d40bf83c
The large learning rate phase of deep learning
The choice of initial learning rate can have a profound effect on the performance of deep networks . We present empirical evidence that networks exhibit sharply distinct behaviors at small and large learning rates . In the small learning rate phase , training can be understood using the existing theory of infinitely wide neural networks . At large learning rates , we find that networks exhibit qualitatively distinct phenomena that can not be explained by existing theory : The loss grows during the early part of training , and optimization eventually converges to a flatter minimum . Furthermore , we find that the optimal performance is often found in the large learning rate phase . To better understand this behavior we analyze the dynamics of a two-layer linear network and prove that it exhibits these different phases . We find good agreement between our analysis and the training dynamics observed in realistic deep learning settings . 1 INTRODUCTION . Deep learning has shown remarkable success across a variety of tasks . At the same time , our theoretical understanding of deep learning methods remains limited . In particular , the interplay between training dynamics , properties of the learned network , and generalization remains a largely open problem . In tackling this problem , much progress has been made by studying deep neural networks whose hidden layers are wide . In the limit of infinite width , connections between stochastic gradient descent ( SGD ) dynamics of neural networks , compositional kernels , and linear models have been made . These connections hold when the learning rate is sufficiently small . However , a theory of the dynamics of deep networks that operate outside this regime remains largely open . In this work , we present evidence that SGD dynamics change significantly when the learning rate is above a critical value , ηcrit , determined by the local curvature of the loss landscape at initialization . These dynamics are stable above the critical learning rate , up to a maximum learning rate ηmax . Training at these large learning rates results in different signatures than observed for learning rates η < ηcrit : the loss initially increases and peaks before decreasing again , and the local curvature drops significantly early in training . We typically find that the best performance is obtained when training above the critical learning rate . Empirically , we find these two learning rate regimes are robust , holding across a variety of architectural and data settings . Figure 1 highlights our key findings . We now describe the main contributions of this work . 1.1 TRAINING WITH A LARGE LEARNING RATE LEADS TO A CATAPULT EFFECT . Consider a deep network defined by the network function f ( θ , x ) , where θ are the model parameters and x the input . We define the curvature λt at training step t to be the max eigenvalue of the Fisher Information Matrix , Ft : = Ex [ ∇θf ( θt , x ) ∇θf ( θt , x ) T ] Amari et al . ( 2000 ) ; Karakida et al . ( 2018 ) . Equivalently , λt is the max eigenvalue of the Neural Tangent Kernel Jacot et al . ( 2018 ) . Figure 2 shows the results of training several deep networks with mean squared error ( MSE ) loss using SGD with a range of learning rates . The loss and curvature are measured at every step during the early part of training . We notice the following effects , which occur when the learning rate is above the critical value ηcrit = 2/λ0 , where λ0 is the curvature at initialization.1 1 . During the first few steps of training , the loss grows significantly compared to its initial value before it begins decreasing . We call this the catapult effect . 2 . Over the same time frame , the curvature decreases until it is below 2/η . We can build intuition for these effects using loss landscape considerations . Consider a linear model where the curvature of the loss landscape is given by λ0 . Here , curvature means the largest eigenvalue of the linear model kernel . The model can be trained using gradient descent as long as the learning rate η obeys η < 2/λ0 . When η > 2/λ0 , the loss diverges and optimization fails . Next , consider a deep network . If we train the model with learning rate η > ηcrit , we may again expect the loss to grow initially , assuming the curvature is approximately constant in the neighborhood of the initial point in parameter space . This is the effect observed in Figure 2 . However , unlike the linear case , optimization may still succeed if gradient descent is able to navigate to an area of the landscape that has lower curvature λ , such that η < 2/λ . This is indeed what we observe in practice . In Figure 1 we show that optimal performance typically occurs when a network is trained in the large learning rate regime . As discussed further in Section 2 , this is true even when the compute budget for smaller learning rates is increased to account for the smaller step size . This is consistent with previous observations in the literature , which showed a correlation between performance and the flatness of the minimum ( Keskar et al. , 2016 ) . 1.2 AT LARGE WIDTH , A SHARP DISTINCTION BETWEEN LEARNING RATES REGIMES . The large width limit of deep networks has been shown to lead to simplified training dynamics that are amenable to theoretical study , as in the case of the Neural Tangent Kernel ( Jacot et al. , 2018 ) . In this work we show that the distinction between small and large learning rates becomes sharply defined at large width . This can be seen in Figures 2c , 2f , which show the curvature of sufficiently wide networks after the initial part of training , as a function of learning rate . When η < ηcrit the curvature is approximately independent of the learning rate , while for η > ηcrit the curvature is lower than 2/η . 1The critical learning rate depends on the scale of initialization through λ0 . In Section 3 we analyze the gradient descent dynamics of 2-layer linear networks , and find that they exhibit similar behavior that can be understood in the large width limit . When training with small learning rates , existing theory can describe the training dynamics of such networks . And , we present new theoretical results that explain the behavior at large learning rates . To summarize our findings , in the large width limit we identify two separate learning rate regimes , or phases , with the following characteristics . Lazy phase : η < 2/λ0 . For sufficiently small learning rate , the curvature λt at training step t remains constant throughout training , and the model becomes equivalent to a linear model ( Jacot et al. , 2018 ; Lee et al. , 2019 ) . The model converges to a nearby point in parameter space , and this behavior is sometimes called lazy training ( Du et al. , 2019 ; Zou et al. , 2018 ; Allen-Zhu et al. , 2019 ; Li & Liang , 2018 ; Chizat et al. , 2019 ) . Catapult phase : ηcrit < η < ηmax . At large learning rates the loss grows to be of order the width n over a number of training steps that is of order log ( n ) . During the same period , the curvature decreases until it is below 2/η . Beyond this point the loss decreases and training converges , ultimately reaching a flat minimum ( relative to that reached in the lazy phase ) . The gradient descent dynamics in this phase are visualized in Figure 1 and in Figure S1 . The maximum learning rate ηmax ( beyond which training no longer converges ) depends on the setup . In our theoretical model the maximum learning rate is ηmax = 4/λ0 . For ReLU networks , we find empirically that ηmax ≈ 12/λ0 . 1.3 LIMITATIONS . Our empirical results and our theoretical analysis focus on the case of MSE loss and on training with vanilla SGD , and do not extend to the case of cross-entropy loss , or to training with other optimizers such as momentum . Additionally , our theoretical analysis involves a 2-layer linear network , and does not apply to the case of networks with non-linearities such as ReLU . 1.4 RELATED WORKS . Our work builds on several existing results , which we now briefly review . The existing theory of infinite width networks is insufficient to describe large learning rates . A recent body of work has investigated the gradient descent dynamics of deep networks in the limit of infinite width ( Daniely , 2017 ; Jacot et al. , 2018 ; Lee et al. , 2019 ; Du et al. , 2019 ; Zou et al. , 2018 ; Allen-Zhu et al. , 2019 ; Li & Liang , 2018 ; Chizat et al. , 2019 ; Mei et al. , 2018 ; Rotskoff & Vanden-Eijnden , 2018 ; Sirignano & Spiliopoulos , 2018 ; Woodworth et al. , 2019 ; Naveh et al . ; Xiao et al. , 2019 ) . Of particular relevance is the work by Jacot et al . ( 2018 ) showing that gradient flow in the space of functions is governed by a dynamical quantity called the Neural Tangent Kernel ( NTK ) which is fixed at its initial value in this limit . Lee et al . ( 2019 ) showed this result is equivalent to training the linearization of a model around its initialization in parameter space . Finally , moving away from the strict limit of infinite width by working perturbatively , Dyer & Gur-Ari ( 2020 ) ; Huang & Yau ( 2019 ) introduced an approach to computing the finite-width corrections to network evolution . Despite this progress , in many practical deep learning settings , the neural network has finite width and evolves nontrivially , with a large change in its associated Neural Tangent Kernel . Depending on the architecture and hyperparameters , such networks may give superior performance . Prior work has compared the performance of finite-width , SGD-trained deep networks with the infinite-width kernels derived from the networks ( Lee et al. , 2018 ; Novak et al. , 2019 ; Arora et al. , 2019 ) . Performance gaps are observed in some cases , notably in convolutional networks , implying that existing infinite-width theory is insufficient to explain the performance of deep networks in such settings where the network evolves nontrivially . Large learning rate SGD improves generalization . SGD training with large initial learning rates often leads to improved performance over training with small initial learning rates ( see ( Li et al. , 2019 ; Leclerc & Madry , 2020 ; Xie et al. , 2020 ; Frankle et al. , 2020 ; Jastrzebski et al. , 2020 ) for recent discussions ) . It has been suggested that one of the mechanisms underlying the benefit of large learning rates is that noise from SGD leads to flat minima , and that flat minima generalize better than sharp minima ( Hochreiter & Schmidhuber , 1997 ; Keskar et al. , 2016 ; Smith & Le , 2018 ; Jiang et al. , 2020 ; Park et al. , 2019 ) ( though see Dinh et al . ( 2017 ) for discussion of some caveats ) . According to this suggestion , training with a large learning rate ( or with a small batch size ) can improve performance because it leads to more stochasticity during training ( Smith & Le , 2018 ; Mandt et al. , 2017 ; Smith et al. , 2017 ; Smith et al. , 2018 ) . We develop a connection between large learning rate and flatness of minima in models trained via SGD . Unlike the relationship explored in most previous work though , this connection is not driven by SGD noise , but arises solely as a result of training with a large initial learning rate , and holds even for full batch gradient descent .
This paper analyzes the effect of choosing a large step-size on the generalization of deep networks. They suggest that starting with a large learning rate, the loss initially increases before converging to a flatter minimum with improved generalization (catapult effect). When the learning rate is above a certain threshold, the authors observed this catapult effect along with a decrease in the curvature of the landscape. These observations were empirically demonstrated through various experiments and analytically studied for a two-layer linear network.
SP:d76bc6a749e9576dade07060b012715c7b96f534
The large learning rate phase of deep learning
The choice of initial learning rate can have a profound effect on the performance of deep networks . We present empirical evidence that networks exhibit sharply distinct behaviors at small and large learning rates . In the small learning rate phase , training can be understood using the existing theory of infinitely wide neural networks . At large learning rates , we find that networks exhibit qualitatively distinct phenomena that can not be explained by existing theory : The loss grows during the early part of training , and optimization eventually converges to a flatter minimum . Furthermore , we find that the optimal performance is often found in the large learning rate phase . To better understand this behavior we analyze the dynamics of a two-layer linear network and prove that it exhibits these different phases . We find good agreement between our analysis and the training dynamics observed in realistic deep learning settings . 1 INTRODUCTION . Deep learning has shown remarkable success across a variety of tasks . At the same time , our theoretical understanding of deep learning methods remains limited . In particular , the interplay between training dynamics , properties of the learned network , and generalization remains a largely open problem . In tackling this problem , much progress has been made by studying deep neural networks whose hidden layers are wide . In the limit of infinite width , connections between stochastic gradient descent ( SGD ) dynamics of neural networks , compositional kernels , and linear models have been made . These connections hold when the learning rate is sufficiently small . However , a theory of the dynamics of deep networks that operate outside this regime remains largely open . In this work , we present evidence that SGD dynamics change significantly when the learning rate is above a critical value , ηcrit , determined by the local curvature of the loss landscape at initialization . These dynamics are stable above the critical learning rate , up to a maximum learning rate ηmax . Training at these large learning rates results in different signatures than observed for learning rates η < ηcrit : the loss initially increases and peaks before decreasing again , and the local curvature drops significantly early in training . We typically find that the best performance is obtained when training above the critical learning rate . Empirically , we find these two learning rate regimes are robust , holding across a variety of architectural and data settings . Figure 1 highlights our key findings . We now describe the main contributions of this work . 1.1 TRAINING WITH A LARGE LEARNING RATE LEADS TO A CATAPULT EFFECT . Consider a deep network defined by the network function f ( θ , x ) , where θ are the model parameters and x the input . We define the curvature λt at training step t to be the max eigenvalue of the Fisher Information Matrix , Ft : = Ex [ ∇θf ( θt , x ) ∇θf ( θt , x ) T ] Amari et al . ( 2000 ) ; Karakida et al . ( 2018 ) . Equivalently , λt is the max eigenvalue of the Neural Tangent Kernel Jacot et al . ( 2018 ) . Figure 2 shows the results of training several deep networks with mean squared error ( MSE ) loss using SGD with a range of learning rates . The loss and curvature are measured at every step during the early part of training . We notice the following effects , which occur when the learning rate is above the critical value ηcrit = 2/λ0 , where λ0 is the curvature at initialization.1 1 . During the first few steps of training , the loss grows significantly compared to its initial value before it begins decreasing . We call this the catapult effect . 2 . Over the same time frame , the curvature decreases until it is below 2/η . We can build intuition for these effects using loss landscape considerations . Consider a linear model where the curvature of the loss landscape is given by λ0 . Here , curvature means the largest eigenvalue of the linear model kernel . The model can be trained using gradient descent as long as the learning rate η obeys η < 2/λ0 . When η > 2/λ0 , the loss diverges and optimization fails . Next , consider a deep network . If we train the model with learning rate η > ηcrit , we may again expect the loss to grow initially , assuming the curvature is approximately constant in the neighborhood of the initial point in parameter space . This is the effect observed in Figure 2 . However , unlike the linear case , optimization may still succeed if gradient descent is able to navigate to an area of the landscape that has lower curvature λ , such that η < 2/λ . This is indeed what we observe in practice . In Figure 1 we show that optimal performance typically occurs when a network is trained in the large learning rate regime . As discussed further in Section 2 , this is true even when the compute budget for smaller learning rates is increased to account for the smaller step size . This is consistent with previous observations in the literature , which showed a correlation between performance and the flatness of the minimum ( Keskar et al. , 2016 ) . 1.2 AT LARGE WIDTH , A SHARP DISTINCTION BETWEEN LEARNING RATES REGIMES . The large width limit of deep networks has been shown to lead to simplified training dynamics that are amenable to theoretical study , as in the case of the Neural Tangent Kernel ( Jacot et al. , 2018 ) . In this work we show that the distinction between small and large learning rates becomes sharply defined at large width . This can be seen in Figures 2c , 2f , which show the curvature of sufficiently wide networks after the initial part of training , as a function of learning rate . When η < ηcrit the curvature is approximately independent of the learning rate , while for η > ηcrit the curvature is lower than 2/η . 1The critical learning rate depends on the scale of initialization through λ0 . In Section 3 we analyze the gradient descent dynamics of 2-layer linear networks , and find that they exhibit similar behavior that can be understood in the large width limit . When training with small learning rates , existing theory can describe the training dynamics of such networks . And , we present new theoretical results that explain the behavior at large learning rates . To summarize our findings , in the large width limit we identify two separate learning rate regimes , or phases , with the following characteristics . Lazy phase : η < 2/λ0 . For sufficiently small learning rate , the curvature λt at training step t remains constant throughout training , and the model becomes equivalent to a linear model ( Jacot et al. , 2018 ; Lee et al. , 2019 ) . The model converges to a nearby point in parameter space , and this behavior is sometimes called lazy training ( Du et al. , 2019 ; Zou et al. , 2018 ; Allen-Zhu et al. , 2019 ; Li & Liang , 2018 ; Chizat et al. , 2019 ) . Catapult phase : ηcrit < η < ηmax . At large learning rates the loss grows to be of order the width n over a number of training steps that is of order log ( n ) . During the same period , the curvature decreases until it is below 2/η . Beyond this point the loss decreases and training converges , ultimately reaching a flat minimum ( relative to that reached in the lazy phase ) . The gradient descent dynamics in this phase are visualized in Figure 1 and in Figure S1 . The maximum learning rate ηmax ( beyond which training no longer converges ) depends on the setup . In our theoretical model the maximum learning rate is ηmax = 4/λ0 . For ReLU networks , we find empirically that ηmax ≈ 12/λ0 . 1.3 LIMITATIONS . Our empirical results and our theoretical analysis focus on the case of MSE loss and on training with vanilla SGD , and do not extend to the case of cross-entropy loss , or to training with other optimizers such as momentum . Additionally , our theoretical analysis involves a 2-layer linear network , and does not apply to the case of networks with non-linearities such as ReLU . 1.4 RELATED WORKS . Our work builds on several existing results , which we now briefly review . The existing theory of infinite width networks is insufficient to describe large learning rates . A recent body of work has investigated the gradient descent dynamics of deep networks in the limit of infinite width ( Daniely , 2017 ; Jacot et al. , 2018 ; Lee et al. , 2019 ; Du et al. , 2019 ; Zou et al. , 2018 ; Allen-Zhu et al. , 2019 ; Li & Liang , 2018 ; Chizat et al. , 2019 ; Mei et al. , 2018 ; Rotskoff & Vanden-Eijnden , 2018 ; Sirignano & Spiliopoulos , 2018 ; Woodworth et al. , 2019 ; Naveh et al . ; Xiao et al. , 2019 ) . Of particular relevance is the work by Jacot et al . ( 2018 ) showing that gradient flow in the space of functions is governed by a dynamical quantity called the Neural Tangent Kernel ( NTK ) which is fixed at its initial value in this limit . Lee et al . ( 2019 ) showed this result is equivalent to training the linearization of a model around its initialization in parameter space . Finally , moving away from the strict limit of infinite width by working perturbatively , Dyer & Gur-Ari ( 2020 ) ; Huang & Yau ( 2019 ) introduced an approach to computing the finite-width corrections to network evolution . Despite this progress , in many practical deep learning settings , the neural network has finite width and evolves nontrivially , with a large change in its associated Neural Tangent Kernel . Depending on the architecture and hyperparameters , such networks may give superior performance . Prior work has compared the performance of finite-width , SGD-trained deep networks with the infinite-width kernels derived from the networks ( Lee et al. , 2018 ; Novak et al. , 2019 ; Arora et al. , 2019 ) . Performance gaps are observed in some cases , notably in convolutional networks , implying that existing infinite-width theory is insufficient to explain the performance of deep networks in such settings where the network evolves nontrivially . Large learning rate SGD improves generalization . SGD training with large initial learning rates often leads to improved performance over training with small initial learning rates ( see ( Li et al. , 2019 ; Leclerc & Madry , 2020 ; Xie et al. , 2020 ; Frankle et al. , 2020 ; Jastrzebski et al. , 2020 ) for recent discussions ) . It has been suggested that one of the mechanisms underlying the benefit of large learning rates is that noise from SGD leads to flat minima , and that flat minima generalize better than sharp minima ( Hochreiter & Schmidhuber , 1997 ; Keskar et al. , 2016 ; Smith & Le , 2018 ; Jiang et al. , 2020 ; Park et al. , 2019 ) ( though see Dinh et al . ( 2017 ) for discussion of some caveats ) . According to this suggestion , training with a large learning rate ( or with a small batch size ) can improve performance because it leads to more stochasticity during training ( Smith & Le , 2018 ; Mandt et al. , 2017 ; Smith et al. , 2017 ; Smith et al. , 2018 ) . We develop a connection between large learning rate and flatness of minima in models trained via SGD . Unlike the relationship explored in most previous work though , this connection is not driven by SGD noise , but arises solely as a result of training with a large initial learning rate , and holds even for full batch gradient descent .
The paper is a detailed account of how large of a learning rate a given mode can take when it is trained by constant step size SGD. Many papers investigated the effect of learning rate (and batch size and width etc…) to the final accuracy. In general, the findings indicate increased accuracy up to a certain threshold (where the algorithm doesn’t converge any more). Such findings are abundant in the literature. However, the present paper investigates the path that SGD takes to get to find those ‘good’ performing points in the weight space. Two phases emerge: monotonic decay in loss vs catapult regime and the latter appears to perform the best.
SP:d76bc6a749e9576dade07060b012715c7b96f534
BREEDS: Benchmarks for Subpopulation Shift
1 INTRODUCTION . Robustness to distribution shift has been the focus of a long line of work in machine learning ( Schlimmer & Granger , 1986 ; Widmer & Kubat , 1993 ; Kelly et al. , 1999 ; Shimodaira , 2000 ; Sugiyama et al. , 2007 ; Quionero-Candela et al. , 2009 ; Moreno-Torres et al. , 2012 ; Sugiyama & Kawanabe , 2012 ) . At a high-level , the goal is to ensure that models perform well not only on unseen samples from the datasets they are trained on , but also on the diverse set of inputs they are likely to encounter in the real world . However , building benchmarks for evaluating such robustness is challenging—it requires modeling realistic data variations in a way that is well-defined , controllable , and easy to simulate . Prior work in this context has focused on building benchmarks that capture distribution shifts caused by natural or adversarial input corruptions ( Szegedy et al. , 2014 ; Fawzi & Frossard , 2015 ; Fawzi et al. , 2016 ; Engstrom et al. , 2019b ; Ford et al. , 2019 ; Hendrycks & Dietterich , 2019 ; Kang et al. , 2019 ) , differences in data sources ( Saenko et al. , 2010 ; Torralba & Efros , 2011 ; Khosla et al. , 2012 ; Tommasi & Tuytelaars , 2014 ; Recht et al. , 2019 ) , and changes in the frequencies of data subpopulations ( Oren et al. , 2019 ; Sagawa et al. , 2020 ) . While each of these approaches captures a different source of real-world distribution shift , we can not expect any single benchmark to be comprehensive . Thus , to obtain a holistic understanding of model robustness , we need to keep expanding our testbed to encompass more natural modes of variation . In this work , we take another step in that direction by studying the following question : How well do models generalize to data subpopulations they have not seen during training ? The notion of subpopulation shift this question refers to is quite pervasive . After all , our training datasets will inevitably fail to perfectly capture the diversity of the real word . Hence , during deployment , our models are bound to encounter unseen subpopulations—for instance , unexpected weather conditions in the self-driving car context or different diagnostic setups in medical applications . OUR CONTRIBUTIONS . The goal of our work is to create large-scale subpopulation shift benchmarks wherein the data subpopulations present during model training and evaluation differ . These benchmarks aim to ∗Equal contribution . 1Code and data available at https : //github.com/MadryLab/BREEDS-Benchmarks . assess how effectively models generalize beyond the limited diversity of their training datasets— e.g. , whether models can recognize Dalmatians as “ dogs ” even when their training data for “ dogs ” comprises only Poodles and Terriers . We show how one can simulate such shifts , fairly naturally , within existing datasets , hence eliminating the need for ( and the potential biases introduced by ) crafting synthetic transformations or collecting additional data . BREEDS benchmarks . The crux of our approach is to leverage existing dataset labels and use them to identify superclasses—i.e. , groups of semantically similar classes . This allows us to construct classification tasks over such superclasses , and repurpose the original dataset classes to be the subpopulations of interest . This , in turn , enables us to induce a subpopulation shift by directly making the subpopulations present in the training and test distributions disjoint . By applying this methodology to the ImageNet dataset ( Deng et al. , 2009 ) , we create a suite of subpopulation shift benchmarks of varying difficulty . This involves modifying the existing ImageNet class hierarchy—WordNet ( Miller , 1995 ) —to ensure that superclasses comprise visually coherent subpopulations . We conduct human studies to validate that the resulting benchmarks capture meaningful subpopulation shifts . Model robustness to subpopulation shift . In order to demonstrate the utility of our benchmarks , we employ them to evaluate the robustness of standard models to subpopulation shift . In general , we find that model performance drops significantly on the shifted distribution—even when this shift does not significantly affect humans . Still , models that are more accurate on the original distribution tend to also be more robust to these subpopulation shifts . Moreover , adapting models to the shifted domain , by retraining their last layer on this domain , only partially recovers the original model performance . Impact of robustness interventions . Finally , we examine whether various train-time interventions , designed to decrease model sensitivity to synthetic data corruptions ( e.g. , ` 2-bounded perturbations ) make models more robust to subpopulation shift . We find that many of these methods offer small , yet non-trivial , improvements along this axis—at times , at the expense of performance on the original distribution . Often , these improvements become more pronounced after retraining the last layer of the model on the shifted distribution . Nevertheless , the increase in model robustness to subpopulation shifts due to these interventions is much smaller than what is observed for other families of input variations such as data corruptions ( Hendrycks & Dietterich , 2019 ; Ford et al. , 2019 ; Kang et al. , 2019 ; Taori et al. , 2020 ) . This indicates that handling subpopulation shifts , such as those present in the BREEDS benchmarks , might require a different set of robustness tools . 2 DESIGNING BENCHMARKS FOR DISTRIBUTION SHIFT . When constructing distribution shift benchmarks , the key design choice lies in specifying the target distribution to be used during model evaluation . This distribution is meant to be a realistic variation of the source distribution , that was used for training . Typically , studies focus on variations due to : • Data corruptions : The target distribution is obtained by modifying inputs from the source distribution via a family of transformations that mimic real-world corruptions , as in Fawzi & Frossard ( 2015 ) ; Fawzi et al . ( 2016 ) ; Engstrom et al . ( 2019b ) ; Hendrycks & Dietterich ( 2019 ) ; Ford et al . ( 2019 ) ; Kang et al . ( 2019 ) ; Shankar et al . ( 2019 ) . • Differences in data sources : Here , the target distribution is an independent dataset for the same task ( Saenko et al. , 2010 ; Torralba & Efros , 2011 ; Tommasi & Tuytelaars , 2014 ; Recht et al. , 2019 ) —e.g. , collected at a different geographic location ( Beery et al. , 2018 ) , time frame ( Kumar et al. , 2020 ) or user population ( Caldas et al. , 2018 ) . For instance , this could involve using PASCAL VOC ( Everingham et al. , 2010 ) to evaluate Caltech101-trained classifiers ( Fei-Fei et al. , 2006 ) . The goal is to test whether models are overly reliant on the idiosyncrasies of their training datasets ( Ponce et al. , 2006 ; Torralba & Efros , 2011 ) . • Subpopulation representation : The source and target distributions differ in terms of how well-represented each subpopulation is . Work in this area typically studies whether models perform equally well across all subpopulations from the perspective of reliability ( Meinshausen et al. , 2015 ; Hu et al. , 2018 ; Duchi & Namkoong , 2018 ; Caldas et al. , 2018 ; Oren et al. , 2019 ; Sagawa et al. , 2020 ) or algorithmic fairness ( Dwork et al. , 2012 ; Kleinberg et al. , 2017 ; Jurgens et al. , 2017 ; Buolamwini & Gebru , 2018 ; Hashimoto et al. , 2018 ) . These variations simulate realistic ways in which the data encountered during deployment can deviate from training conditions . However , each of the aforementioned benchmarks capture only one facet of real-world distribution shifts . It is not clear a priori that robustness to any subset of these variations will necessarily translate to robustness with respect to the rest . Thus , to effectively assess and improve model robustness , we require a varied suite of distribution shift benchmarks . 3 THE BREEDS METHODOLOGY . In this work , we focus on modeling a pertinent , yet less studied , form of subpopulation shift : one wherein the target distribution ( used for testing ) contains subpopulations that are entirely absent from the source distribution that the model was trained on . To simulate such shifts , we need to precisely control the data subpopulations present in the source and target data distributions . Our procedure for doing this comprises two stages that are outlined below—see Figure 1 for an illustration and Appendix A.2 for pseudocode . Devising subpopulation structure . Typical datasets do not contain annotations for individual subpopulations . Since collecting such annotations would be challenging , we take an alternative approach : we bootstrap the existing dataset labels to simulate subpopulations . That is , we group semantically similar classes into broader superclasses which , in turn , allows us to re-purpose existing class labels as the desired subpopulation annotations . Moreover , we can group classes in a hierarchical manner , obtaining superclasses of different specificity . As we will see in Section 4 , such class hierarchies are already present in large-scale benchmarks ( Deng et al. , 2009 ; Kuznetsova et al. , 2018 ) . Simulating subpopulation shifts . Given a set of superclasses , we can define a classification task over them : the inputs of each superclass correspond to pooling together the inputs of its subclasses ( i.e. , the original dataset classes ) . Within this setup , we can simulate subpopulation shift in a relatively straightforward manner . Specifically , for each superclass , we split its subclasses into two random and disjoint sets , and assign one of them to the source and the other to the target domain . Then , we can evaluate model robustness under subpopulation shift by simply training on the source domain and testing on the target domain . Note that the classification task remains identical between domains—both domains contain the same ( super ) classes but the subpopulations that comprise each ( super ) class differ . 2 Intuitively , this corresponds to using different dog breeds to represent the class “ dog ” during training and testing—hence the name of our toolkit . This methodology is quite general and can be applied to a variety of setting to simulate realistic distribution shifts . Moreover , it has a number of additional benefits : • Flexibility : Different semantic groupings of a fixed set of classes lead to BREEDS tasks of varying granularity . For instance , by only grouping together classes that are quite similar 2Note that this approach can be extended to simulate milder subpopulation shifts where the source and target distributions overlap but the relative subpopulation frequencies vary , similar to the setting of Oren et al . ( 2019 ) . one can reduce the severity of the subpopulation shift . Alternatively , one can consider broad superclasses , each having multiple subclasses , resulting in a more challenging benchmark . • Precise characterization : The exact subpopulation shift between the source and target domains is known . Since both domains are constructed from the same dataset , the impact of any external factors ( e.g. , differences in data collection pipelines ) is minimized . Note that such external factors can significantly impact the difficulty of the task ( Ponce et al. , 2006 ; Torralba & Efros , 2011 ; Tsipras et al. , 2020 ) . In fact , minimizing these effects and ensuring that the shift between the source and target domain is caused solely by the intended input variations is one of the major challenges in building distribution shift benchmarks . For instance , recent work ( Engstrom et al. , 2020 ) demonstrates that statistical biases during data collection can significantly skew the intended target distribution . • Symmetry : Since subpopulations are split into the source and test domains randomly , we expect the resulting tasks to have comparable difficulty . • Reuse of existing datasets : No additional data collection or annotation is required other than choosing the class grouping . This approach can thus be used to also re-purpose other existing large-scale datasets—even beyond image recognition—with minimal effort .
The authors develop a framework named BREEDS for studying population shift, putting it in their words, they address the problem of how well do models generalize to data subpopulations they have seen during training, in the specific domain of images, without altering the inputs or requiring new data. They propose to create large scale subpopulation shift benchmarks to assess how models generalize beyond the diversity of the training examples. The underlying idea is to identify superclasses from the dataset.
SP:ed3aac329a61708dcf1038eb390b0a2c5216bc46
BREEDS: Benchmarks for Subpopulation Shift
1 INTRODUCTION . Robustness to distribution shift has been the focus of a long line of work in machine learning ( Schlimmer & Granger , 1986 ; Widmer & Kubat , 1993 ; Kelly et al. , 1999 ; Shimodaira , 2000 ; Sugiyama et al. , 2007 ; Quionero-Candela et al. , 2009 ; Moreno-Torres et al. , 2012 ; Sugiyama & Kawanabe , 2012 ) . At a high-level , the goal is to ensure that models perform well not only on unseen samples from the datasets they are trained on , but also on the diverse set of inputs they are likely to encounter in the real world . However , building benchmarks for evaluating such robustness is challenging—it requires modeling realistic data variations in a way that is well-defined , controllable , and easy to simulate . Prior work in this context has focused on building benchmarks that capture distribution shifts caused by natural or adversarial input corruptions ( Szegedy et al. , 2014 ; Fawzi & Frossard , 2015 ; Fawzi et al. , 2016 ; Engstrom et al. , 2019b ; Ford et al. , 2019 ; Hendrycks & Dietterich , 2019 ; Kang et al. , 2019 ) , differences in data sources ( Saenko et al. , 2010 ; Torralba & Efros , 2011 ; Khosla et al. , 2012 ; Tommasi & Tuytelaars , 2014 ; Recht et al. , 2019 ) , and changes in the frequencies of data subpopulations ( Oren et al. , 2019 ; Sagawa et al. , 2020 ) . While each of these approaches captures a different source of real-world distribution shift , we can not expect any single benchmark to be comprehensive . Thus , to obtain a holistic understanding of model robustness , we need to keep expanding our testbed to encompass more natural modes of variation . In this work , we take another step in that direction by studying the following question : How well do models generalize to data subpopulations they have not seen during training ? The notion of subpopulation shift this question refers to is quite pervasive . After all , our training datasets will inevitably fail to perfectly capture the diversity of the real word . Hence , during deployment , our models are bound to encounter unseen subpopulations—for instance , unexpected weather conditions in the self-driving car context or different diagnostic setups in medical applications . OUR CONTRIBUTIONS . The goal of our work is to create large-scale subpopulation shift benchmarks wherein the data subpopulations present during model training and evaluation differ . These benchmarks aim to ∗Equal contribution . 1Code and data available at https : //github.com/MadryLab/BREEDS-Benchmarks . assess how effectively models generalize beyond the limited diversity of their training datasets— e.g. , whether models can recognize Dalmatians as “ dogs ” even when their training data for “ dogs ” comprises only Poodles and Terriers . We show how one can simulate such shifts , fairly naturally , within existing datasets , hence eliminating the need for ( and the potential biases introduced by ) crafting synthetic transformations or collecting additional data . BREEDS benchmarks . The crux of our approach is to leverage existing dataset labels and use them to identify superclasses—i.e. , groups of semantically similar classes . This allows us to construct classification tasks over such superclasses , and repurpose the original dataset classes to be the subpopulations of interest . This , in turn , enables us to induce a subpopulation shift by directly making the subpopulations present in the training and test distributions disjoint . By applying this methodology to the ImageNet dataset ( Deng et al. , 2009 ) , we create a suite of subpopulation shift benchmarks of varying difficulty . This involves modifying the existing ImageNet class hierarchy—WordNet ( Miller , 1995 ) —to ensure that superclasses comprise visually coherent subpopulations . We conduct human studies to validate that the resulting benchmarks capture meaningful subpopulation shifts . Model robustness to subpopulation shift . In order to demonstrate the utility of our benchmarks , we employ them to evaluate the robustness of standard models to subpopulation shift . In general , we find that model performance drops significantly on the shifted distribution—even when this shift does not significantly affect humans . Still , models that are more accurate on the original distribution tend to also be more robust to these subpopulation shifts . Moreover , adapting models to the shifted domain , by retraining their last layer on this domain , only partially recovers the original model performance . Impact of robustness interventions . Finally , we examine whether various train-time interventions , designed to decrease model sensitivity to synthetic data corruptions ( e.g. , ` 2-bounded perturbations ) make models more robust to subpopulation shift . We find that many of these methods offer small , yet non-trivial , improvements along this axis—at times , at the expense of performance on the original distribution . Often , these improvements become more pronounced after retraining the last layer of the model on the shifted distribution . Nevertheless , the increase in model robustness to subpopulation shifts due to these interventions is much smaller than what is observed for other families of input variations such as data corruptions ( Hendrycks & Dietterich , 2019 ; Ford et al. , 2019 ; Kang et al. , 2019 ; Taori et al. , 2020 ) . This indicates that handling subpopulation shifts , such as those present in the BREEDS benchmarks , might require a different set of robustness tools . 2 DESIGNING BENCHMARKS FOR DISTRIBUTION SHIFT . When constructing distribution shift benchmarks , the key design choice lies in specifying the target distribution to be used during model evaluation . This distribution is meant to be a realistic variation of the source distribution , that was used for training . Typically , studies focus on variations due to : • Data corruptions : The target distribution is obtained by modifying inputs from the source distribution via a family of transformations that mimic real-world corruptions , as in Fawzi & Frossard ( 2015 ) ; Fawzi et al . ( 2016 ) ; Engstrom et al . ( 2019b ) ; Hendrycks & Dietterich ( 2019 ) ; Ford et al . ( 2019 ) ; Kang et al . ( 2019 ) ; Shankar et al . ( 2019 ) . • Differences in data sources : Here , the target distribution is an independent dataset for the same task ( Saenko et al. , 2010 ; Torralba & Efros , 2011 ; Tommasi & Tuytelaars , 2014 ; Recht et al. , 2019 ) —e.g. , collected at a different geographic location ( Beery et al. , 2018 ) , time frame ( Kumar et al. , 2020 ) or user population ( Caldas et al. , 2018 ) . For instance , this could involve using PASCAL VOC ( Everingham et al. , 2010 ) to evaluate Caltech101-trained classifiers ( Fei-Fei et al. , 2006 ) . The goal is to test whether models are overly reliant on the idiosyncrasies of their training datasets ( Ponce et al. , 2006 ; Torralba & Efros , 2011 ) . • Subpopulation representation : The source and target distributions differ in terms of how well-represented each subpopulation is . Work in this area typically studies whether models perform equally well across all subpopulations from the perspective of reliability ( Meinshausen et al. , 2015 ; Hu et al. , 2018 ; Duchi & Namkoong , 2018 ; Caldas et al. , 2018 ; Oren et al. , 2019 ; Sagawa et al. , 2020 ) or algorithmic fairness ( Dwork et al. , 2012 ; Kleinberg et al. , 2017 ; Jurgens et al. , 2017 ; Buolamwini & Gebru , 2018 ; Hashimoto et al. , 2018 ) . These variations simulate realistic ways in which the data encountered during deployment can deviate from training conditions . However , each of the aforementioned benchmarks capture only one facet of real-world distribution shifts . It is not clear a priori that robustness to any subset of these variations will necessarily translate to robustness with respect to the rest . Thus , to effectively assess and improve model robustness , we require a varied suite of distribution shift benchmarks . 3 THE BREEDS METHODOLOGY . In this work , we focus on modeling a pertinent , yet less studied , form of subpopulation shift : one wherein the target distribution ( used for testing ) contains subpopulations that are entirely absent from the source distribution that the model was trained on . To simulate such shifts , we need to precisely control the data subpopulations present in the source and target data distributions . Our procedure for doing this comprises two stages that are outlined below—see Figure 1 for an illustration and Appendix A.2 for pseudocode . Devising subpopulation structure . Typical datasets do not contain annotations for individual subpopulations . Since collecting such annotations would be challenging , we take an alternative approach : we bootstrap the existing dataset labels to simulate subpopulations . That is , we group semantically similar classes into broader superclasses which , in turn , allows us to re-purpose existing class labels as the desired subpopulation annotations . Moreover , we can group classes in a hierarchical manner , obtaining superclasses of different specificity . As we will see in Section 4 , such class hierarchies are already present in large-scale benchmarks ( Deng et al. , 2009 ; Kuznetsova et al. , 2018 ) . Simulating subpopulation shifts . Given a set of superclasses , we can define a classification task over them : the inputs of each superclass correspond to pooling together the inputs of its subclasses ( i.e. , the original dataset classes ) . Within this setup , we can simulate subpopulation shift in a relatively straightforward manner . Specifically , for each superclass , we split its subclasses into two random and disjoint sets , and assign one of them to the source and the other to the target domain . Then , we can evaluate model robustness under subpopulation shift by simply training on the source domain and testing on the target domain . Note that the classification task remains identical between domains—both domains contain the same ( super ) classes but the subpopulations that comprise each ( super ) class differ . 2 Intuitively , this corresponds to using different dog breeds to represent the class “ dog ” during training and testing—hence the name of our toolkit . This methodology is quite general and can be applied to a variety of setting to simulate realistic distribution shifts . Moreover , it has a number of additional benefits : • Flexibility : Different semantic groupings of a fixed set of classes lead to BREEDS tasks of varying granularity . For instance , by only grouping together classes that are quite similar 2Note that this approach can be extended to simulate milder subpopulation shifts where the source and target distributions overlap but the relative subpopulation frequencies vary , similar to the setting of Oren et al . ( 2019 ) . one can reduce the severity of the subpopulation shift . Alternatively , one can consider broad superclasses , each having multiple subclasses , resulting in a more challenging benchmark . • Precise characterization : The exact subpopulation shift between the source and target domains is known . Since both domains are constructed from the same dataset , the impact of any external factors ( e.g. , differences in data collection pipelines ) is minimized . Note that such external factors can significantly impact the difficulty of the task ( Ponce et al. , 2006 ; Torralba & Efros , 2011 ; Tsipras et al. , 2020 ) . In fact , minimizing these effects and ensuring that the shift between the source and target domain is caused solely by the intended input variations is one of the major challenges in building distribution shift benchmarks . For instance , recent work ( Engstrom et al. , 2020 ) demonstrates that statistical biases during data collection can significantly skew the intended target distribution . • Symmetry : Since subpopulations are split into the source and test domains randomly , we expect the resulting tasks to have comparable difficulty . • Reuse of existing datasets : No additional data collection or annotation is required other than choosing the class grouping . This approach can thus be used to also re-purpose other existing large-scale datasets—even beyond image recognition—with minimal effort .
This paper addresses the problem of model robustness to subpopulation shift. Authors propose building large-scale subpopulation shift benchmarks wherein the data subpopulations present during model training and evaluation differ. In this regard, their approach is based on leveraging existing dataset labels and use them to identify superclasses to construct classification tasks over such superclasses and repurpose the original dataset classes to be the subpopulations of interest. They train some learning models over the generated benchmarks to evaluate model robustness to subpopulation shift and, finally, they try various learning interventions (from the literature) to decrease model sensitivity to this sort of data perturbations.
SP:ed3aac329a61708dcf1038eb390b0a2c5216bc46
Untangle: Critiquing Disentangled Recommendations
1 Introduction . Figure 1 : Untangle model is trained in two phases : Disentangling phase : Input to encoder is a one hot representation of an item ( green dotted line ) . Obtained representation is disentangled across A attributes . Recommendation phase : Input to encoder is the items user interacted with ( solid red line ) and recommends new items . User and item representations form the basis of typical collaborative filtering recommendation models . These representations can be learned through various techniques such as Matrix Factorization ( 1 ; 2 ) , or are constructed dynamically during inference e.g . the hidden state of RNN ’ s in session-based recommendations ( 3 ; 4 ) . As most standard recommendation models solely aim at increasing the performance of the system , no special care is taken to ensure interpretability of the user and item representations . These representations do not explicitly encode user preferences over item attributes . Hence , they can not be easily used by users to change a.k.a . critique ( 5 ) the recommendations . For instance , a user in a recipe recommendation system can not ask for recommendations for a set of less spicy recipes , as the spiciness is not explicitly encoded in the latent space . Moreover the explainability of the recommendations that are provided by such systems is very limited . In this work , we enrich a state-of-the-art recommendation model to explicitly encode preferences over item attributes in the user latent space while simultaneously optimizing for recommendation ’ s performance . Our work is motivated by disentangled representations in other domains , e.g. , manipulating generative models of images with specific characteristics ( 6 ) or text with certain attributes ( 7 ) . Variational Autoencoders ( VAEs ) , particularly β-VAE ’ s ( 8 ) ( which we adapt here ) , are generally used to learn these disentangled representations . Intuitively , they optimize embeddings to capture meaningful aspects of users and items independently . Consequently , such embeddings will be more usable for critiquing . There are two types of disentangling β-VAEs : unsupervised and supervised . In the former , the representations are disentangled to explanatory factors of variation in an unsupervised manner , i.e. , without assuming additional information on the existence ( or not ) of specific aspects . Used in the original β-VAE ( 8 ) approach , a lack of supervision often results in inconsistency and instability in disentangled representations ( 9 ) . In contrast , in supervised disentangling , a small subset of data is assumed to have side-information ( i.e . a label or a tag ) . This small subset is then used to disentangle into meaningful factors ( 10 ; 9 ) . As critiquing requires user control using familiar terms/attributes , we incorporate supervised disentanglement in a β-VAE architecture in this work . To achieve the explicit encoding of preferences over item attributes in embedding space we refine the training strategy of the untangle model . We essentially train in two phases : i ) Disentangling phase : We explicitly disentangle item representations , using very few supervised labels . ii ) Recommendation phase : We encode the user , using the bag-of-words representation of the items interacted , and then generate the list of recommended items . Untangle gives fine-grained control over the recommendations across various item attributes , as compared to the baseline . We achieve this with a tiny fraction of attribute labels over items , and moreover achieve comparable recommendation performance compared to state-of-the-art baselines . 2 Related Work . Deep learning based Autoencoder architectures are routinely used in collaborative filtering and recommendation models ( 11 ; 12 ; 13 ) . In particular ( 11 ; 12 ) adopt denoising autoencoder architectures , whereas ( 13 ) uses variational autoencoders . The internal ( hidden ) representations generated by the encoders in these models are not interpretable and hence can not be used for critiquing or explanations in recommendations . Recent work on Variational Autoencoders across domains have focused on the task of generating disentangled representations . One of the first approaches used to that end was β-VAE ( 8 ; 14 ; 15 ) , which essentially enforced a stronger ( multiplying that term with β > 1 ) KL divergence constraint on the VAE objective . Such representations are more controllable and interpretable as compared to VAEs . One of the drawbacks of β-VAE is that the disentanglement of the factors can not be controlled and that they are relatively unstable and not easy to reproduce particularly when the factors of variance are subtle ( 9 ; 8 ; 14 ; 16 ; 17 ) . This has motivated methods that explicitly supervise the disentangling ( 10 ) , that rely either on selecting a good set of disentangling using multiple runs and the label information ( 18 ) , or by adding a supervised loss function in the β-VAE objective function ( 10 ) . As supervised disentangling methods are better in explainability and could provide control over desired attributes , we motivate our model from ( 19 ) for better critiquing in VAE based recommendation systems . In recommender systems similar methods to utilize side information , have also been used recently to allow for models that enable critiquing of recommendations . These models allow users to tune the recommendations across some provided attributes/dimensions . Notable examples are ( 20 ; 21 ) , where the models are augmented with a classifier of the features over which to control the recommendation . Adjusting the features at the output of the classifier modifies the internal hidden state of the model and leads to recommendations that exhibit or not the requested attribute . Note that this method of critiquing is quite different to our approach which allows for a gradual adjustment of the attributtes . Moreover the models in ( 20 ; 21 ) require a fully labeled dataset with respect to the attributes while our approach only requires a small fraction of labeled data . Unsupervised disentanglement was also recently used to identify and potentially use factors of variation from purely collaborative data i.e. , data generated by user interactions with items ( 22 ) note though that this method focus was mainly on performance of the recommendations and that it does not allow for seamless critiquing as it is not clear what aspect of the data get disentangled . 3 Untangle . The aim of the untangle model is to obtaining controllable user ( and item ) representations for better critiquing along with optimizing for recommendation performance . To this end , we incorporate a simple supervised disentanglement technique to disentangle across item attributes/characteristics over which we want to provide explicit control to the users . We index users with u ∈ { 1 , . . . , n } , and items with i ∈ { 1 , . . . , m } . Xn×m is a matrix of user-item interactions ( xui = 1 if user u interacted with item i , and 0 otherwise ) . A subset of items are assumed to have binary labels for attributes A . Our model is a modified β-VAE architecture , with a feed forward network based encoder and decoder . In Figure 1 , user u is represented by [ z : c ] . Note that : stands for concatenation , the z part of the representation is non-interpretable by default while on the c part of the representation we map ( through a refined learning step ) the representation of the attributes of the items over which we would like the user to have control . Each dimension in c is mapped to only one attribute a . Across the paper , we refer the dimension associated with the attribute a , as ca . The user representation is sampled from the distribution parameterized by the encoder ( qφ ) : qφ ( xu∗ ) = N ( µφ ( xu∗ ) , diag ( σφ ( xu∗ ) ) . The input to the encoder is the bag of words representation of the items u interacted with , i.e . the uth row of matrix X , xu∗ . The decoder generates the probability distribution given user representation [ z : c ] , π ( z ) ∝ exp ( fdecφ ( [ z : c ] ) ) , over the m items . The likelihood function used in recommender system settings ( 3 ; 23 ; 24 ; 25 ) is typically the multinomial likelihood : pθ ( xu| [ z : c ] ) = ∑ i xui log πi ( [ z : c ] ) ) 3.1 Learning . Training is conducted in two phases : Recommendation and Disentangle phase , as mentioned in Algorithm 1 . Recommendation Phase The objective in this phase is to optimize the encoder parameterized by ( θ ) , and decoder parameterized by ( ψ ) to generate personalized recommendations . We train our model with the following objective : L ( xu∗ , θ , φ ) ≡ Eqθ ( [ z : c ] |xu∗ ) [ logpθ ( xu∗| [ z : c ] ) ] − βKL ( qφ ( [ z : c ] |xu∗ ) |p ( [ z : c ] ) ) ( 1 ) Intuitively , this is the negative reconstruction error minus the Kullback-Leibler divergence enforcing the posterior distribution of z to be close to the Gaussian distribution ( prior ) p ( z ) . The KL divergence in β-VAE is computed between the representation sampled from the encoder and the normal distribution p ( z ) = N ( 0 , Id ) . The diagonal co-variance matrix enforces a degree of independence among the individual factors of the representation . Consequently , increasing the weight of the KL divergence term with β > 1 boosts the feature independence criteria , leading to disentangled representation . This ensures that even in the recommendation phase , the learnt user representations are nudged towards disentanglement . Disentanglement Phase Since the attribute information is commonly available across the items . In this phase , we first obtain the item representation in the user latent space ( as depicted in the highlighted green box in Figure 1 ) . We pass the one hot encoding of an item , and obtain its representation in the latent user space . We then disentangle the obtained representation using the following objective : ( 2 ) L ( 1i , θ , φ ) ≡ Eqθ ( [ z : c ] |1i ) [ logpθ ( 1i| [ z : c ] ) ] − βKL ( qφ ( [ z : c ] |1i ) |p ( [ z : c ] ) ) + γEqθ ( c|1i ) l ( qφ ( c|1i ) , a ) Algorithm 1 : Untangle : Training Data : X ∈ Rn×m containing user-item interactions , with a subset of items having labels for A attributes 1 initialize model params . : Encoder ( φ ) , Decoder ( θ ) ; 2 do 3 if is_disentangle then // Disentangle representations 4 1i ← random mini batch from set of items that are labelled with A set . 5 [ z : c ] ← sample from N ( µφ ( 1i ) , diag ( σφ ( 1i ) ) 6 x̃i∗ ← Decoder ( [ z : c ] ) 7 compute gradients ∇Lφ , ∇Lθ using Objective 2 8 φ← φ+∇Lφ 9 θ ← θ +∇Lθ 10 end 11 if is_recommend then // Recommend items 12 xu∗ ← random mini-batch from dataset 13 [ z : c ] ← sample from N ( µφ ( xu∗ ) , diag ( σφ ( xu∗ ) ) 14 x̃u∗ ← Decoder ( [ z : c ] ) 15 compute gradients ∇Lφ , ∇Lθ using Objective 1 16 φ← φ+∇Lφ 17 θ ← θ +∇Lθ 18 end 19 while model converges ; As in ( 10 ) , we modify the β-VAE objective ( Objective 1 ) in to incorporate a classification loss over the factors c , over which we disentangle . This loss penalizes discrepancies between the attribute label prediction for factor ca and the label a of interest , nudging the disentanglement for each attribute to happen over the corresponding factor ca .
The paper proposes a framework to learn disentangled representations for collaborative filtering systems. To model the user-item interactions, the authors adopt the likelihood model proposed by \beta-Multi-VAE. The auxiliary task of predicting item labels is considered to increase the disentanglement and the ability to control the recommendations. Practical performance and the properties of disentanglement are demonstrated in experiments on real data sets.
SP:3e632e5be2e41e5bb76f85ab673c8530d3e9a169
Untangle: Critiquing Disentangled Recommendations
1 Introduction . Figure 1 : Untangle model is trained in two phases : Disentangling phase : Input to encoder is a one hot representation of an item ( green dotted line ) . Obtained representation is disentangled across A attributes . Recommendation phase : Input to encoder is the items user interacted with ( solid red line ) and recommends new items . User and item representations form the basis of typical collaborative filtering recommendation models . These representations can be learned through various techniques such as Matrix Factorization ( 1 ; 2 ) , or are constructed dynamically during inference e.g . the hidden state of RNN ’ s in session-based recommendations ( 3 ; 4 ) . As most standard recommendation models solely aim at increasing the performance of the system , no special care is taken to ensure interpretability of the user and item representations . These representations do not explicitly encode user preferences over item attributes . Hence , they can not be easily used by users to change a.k.a . critique ( 5 ) the recommendations . For instance , a user in a recipe recommendation system can not ask for recommendations for a set of less spicy recipes , as the spiciness is not explicitly encoded in the latent space . Moreover the explainability of the recommendations that are provided by such systems is very limited . In this work , we enrich a state-of-the-art recommendation model to explicitly encode preferences over item attributes in the user latent space while simultaneously optimizing for recommendation ’ s performance . Our work is motivated by disentangled representations in other domains , e.g. , manipulating generative models of images with specific characteristics ( 6 ) or text with certain attributes ( 7 ) . Variational Autoencoders ( VAEs ) , particularly β-VAE ’ s ( 8 ) ( which we adapt here ) , are generally used to learn these disentangled representations . Intuitively , they optimize embeddings to capture meaningful aspects of users and items independently . Consequently , such embeddings will be more usable for critiquing . There are two types of disentangling β-VAEs : unsupervised and supervised . In the former , the representations are disentangled to explanatory factors of variation in an unsupervised manner , i.e. , without assuming additional information on the existence ( or not ) of specific aspects . Used in the original β-VAE ( 8 ) approach , a lack of supervision often results in inconsistency and instability in disentangled representations ( 9 ) . In contrast , in supervised disentangling , a small subset of data is assumed to have side-information ( i.e . a label or a tag ) . This small subset is then used to disentangle into meaningful factors ( 10 ; 9 ) . As critiquing requires user control using familiar terms/attributes , we incorporate supervised disentanglement in a β-VAE architecture in this work . To achieve the explicit encoding of preferences over item attributes in embedding space we refine the training strategy of the untangle model . We essentially train in two phases : i ) Disentangling phase : We explicitly disentangle item representations , using very few supervised labels . ii ) Recommendation phase : We encode the user , using the bag-of-words representation of the items interacted , and then generate the list of recommended items . Untangle gives fine-grained control over the recommendations across various item attributes , as compared to the baseline . We achieve this with a tiny fraction of attribute labels over items , and moreover achieve comparable recommendation performance compared to state-of-the-art baselines . 2 Related Work . Deep learning based Autoencoder architectures are routinely used in collaborative filtering and recommendation models ( 11 ; 12 ; 13 ) . In particular ( 11 ; 12 ) adopt denoising autoencoder architectures , whereas ( 13 ) uses variational autoencoders . The internal ( hidden ) representations generated by the encoders in these models are not interpretable and hence can not be used for critiquing or explanations in recommendations . Recent work on Variational Autoencoders across domains have focused on the task of generating disentangled representations . One of the first approaches used to that end was β-VAE ( 8 ; 14 ; 15 ) , which essentially enforced a stronger ( multiplying that term with β > 1 ) KL divergence constraint on the VAE objective . Such representations are more controllable and interpretable as compared to VAEs . One of the drawbacks of β-VAE is that the disentanglement of the factors can not be controlled and that they are relatively unstable and not easy to reproduce particularly when the factors of variance are subtle ( 9 ; 8 ; 14 ; 16 ; 17 ) . This has motivated methods that explicitly supervise the disentangling ( 10 ) , that rely either on selecting a good set of disentangling using multiple runs and the label information ( 18 ) , or by adding a supervised loss function in the β-VAE objective function ( 10 ) . As supervised disentangling methods are better in explainability and could provide control over desired attributes , we motivate our model from ( 19 ) for better critiquing in VAE based recommendation systems . In recommender systems similar methods to utilize side information , have also been used recently to allow for models that enable critiquing of recommendations . These models allow users to tune the recommendations across some provided attributes/dimensions . Notable examples are ( 20 ; 21 ) , where the models are augmented with a classifier of the features over which to control the recommendation . Adjusting the features at the output of the classifier modifies the internal hidden state of the model and leads to recommendations that exhibit or not the requested attribute . Note that this method of critiquing is quite different to our approach which allows for a gradual adjustment of the attributtes . Moreover the models in ( 20 ; 21 ) require a fully labeled dataset with respect to the attributes while our approach only requires a small fraction of labeled data . Unsupervised disentanglement was also recently used to identify and potentially use factors of variation from purely collaborative data i.e. , data generated by user interactions with items ( 22 ) note though that this method focus was mainly on performance of the recommendations and that it does not allow for seamless critiquing as it is not clear what aspect of the data get disentangled . 3 Untangle . The aim of the untangle model is to obtaining controllable user ( and item ) representations for better critiquing along with optimizing for recommendation performance . To this end , we incorporate a simple supervised disentanglement technique to disentangle across item attributes/characteristics over which we want to provide explicit control to the users . We index users with u ∈ { 1 , . . . , n } , and items with i ∈ { 1 , . . . , m } . Xn×m is a matrix of user-item interactions ( xui = 1 if user u interacted with item i , and 0 otherwise ) . A subset of items are assumed to have binary labels for attributes A . Our model is a modified β-VAE architecture , with a feed forward network based encoder and decoder . In Figure 1 , user u is represented by [ z : c ] . Note that : stands for concatenation , the z part of the representation is non-interpretable by default while on the c part of the representation we map ( through a refined learning step ) the representation of the attributes of the items over which we would like the user to have control . Each dimension in c is mapped to only one attribute a . Across the paper , we refer the dimension associated with the attribute a , as ca . The user representation is sampled from the distribution parameterized by the encoder ( qφ ) : qφ ( xu∗ ) = N ( µφ ( xu∗ ) , diag ( σφ ( xu∗ ) ) . The input to the encoder is the bag of words representation of the items u interacted with , i.e . the uth row of matrix X , xu∗ . The decoder generates the probability distribution given user representation [ z : c ] , π ( z ) ∝ exp ( fdecφ ( [ z : c ] ) ) , over the m items . The likelihood function used in recommender system settings ( 3 ; 23 ; 24 ; 25 ) is typically the multinomial likelihood : pθ ( xu| [ z : c ] ) = ∑ i xui log πi ( [ z : c ] ) ) 3.1 Learning . Training is conducted in two phases : Recommendation and Disentangle phase , as mentioned in Algorithm 1 . Recommendation Phase The objective in this phase is to optimize the encoder parameterized by ( θ ) , and decoder parameterized by ( ψ ) to generate personalized recommendations . We train our model with the following objective : L ( xu∗ , θ , φ ) ≡ Eqθ ( [ z : c ] |xu∗ ) [ logpθ ( xu∗| [ z : c ] ) ] − βKL ( qφ ( [ z : c ] |xu∗ ) |p ( [ z : c ] ) ) ( 1 ) Intuitively , this is the negative reconstruction error minus the Kullback-Leibler divergence enforcing the posterior distribution of z to be close to the Gaussian distribution ( prior ) p ( z ) . The KL divergence in β-VAE is computed between the representation sampled from the encoder and the normal distribution p ( z ) = N ( 0 , Id ) . The diagonal co-variance matrix enforces a degree of independence among the individual factors of the representation . Consequently , increasing the weight of the KL divergence term with β > 1 boosts the feature independence criteria , leading to disentangled representation . This ensures that even in the recommendation phase , the learnt user representations are nudged towards disentanglement . Disentanglement Phase Since the attribute information is commonly available across the items . In this phase , we first obtain the item representation in the user latent space ( as depicted in the highlighted green box in Figure 1 ) . We pass the one hot encoding of an item , and obtain its representation in the latent user space . We then disentangle the obtained representation using the following objective : ( 2 ) L ( 1i , θ , φ ) ≡ Eqθ ( [ z : c ] |1i ) [ logpθ ( 1i| [ z : c ] ) ] − βKL ( qφ ( [ z : c ] |1i ) |p ( [ z : c ] ) ) + γEqθ ( c|1i ) l ( qφ ( c|1i ) , a ) Algorithm 1 : Untangle : Training Data : X ∈ Rn×m containing user-item interactions , with a subset of items having labels for A attributes 1 initialize model params . : Encoder ( φ ) , Decoder ( θ ) ; 2 do 3 if is_disentangle then // Disentangle representations 4 1i ← random mini batch from set of items that are labelled with A set . 5 [ z : c ] ← sample from N ( µφ ( 1i ) , diag ( σφ ( 1i ) ) 6 x̃i∗ ← Decoder ( [ z : c ] ) 7 compute gradients ∇Lφ , ∇Lθ using Objective 2 8 φ← φ+∇Lφ 9 θ ← θ +∇Lθ 10 end 11 if is_recommend then // Recommend items 12 xu∗ ← random mini-batch from dataset 13 [ z : c ] ← sample from N ( µφ ( xu∗ ) , diag ( σφ ( xu∗ ) ) 14 x̃u∗ ← Decoder ( [ z : c ] ) 15 compute gradients ∇Lφ , ∇Lθ using Objective 1 16 φ← φ+∇Lφ 17 θ ← θ +∇Lθ 18 end 19 while model converges ; As in ( 10 ) , we modify the β-VAE objective ( Objective 1 ) in to incorporate a classification loss over the factors c , over which we disentangle . This loss penalizes discrepancies between the attribute label prediction for factor ca and the label a of interest , nudging the disentanglement for each attribute to happen over the corresponding factor ca .
The submission aims to develop a disentangled recommender that explicitly grants the users the ability to control a chosen aspect of the recommendation list. This is achieved by (1) learning disentangled user/item representations via beta-VAE and (2) aligning text tags with certain dimensions via an auxiliary loss (the term after gamma in Eq 2). Empirical results demonstrate that this supervised approach outperforms the unsupervised baselines in terms of disentanglement and controllability, e.g., it can explicitly control the recommender to recommend a list of romantic movies.
SP:3e632e5be2e41e5bb76f85ab673c8530d3e9a169
CoDA: Contrast-enhanced and Diversity-promoting Data Augmentation for Natural Language Understanding
1 INTRODUCTION . Data augmentation approaches have successfully improved large-scale neural-network-based models , ( Laine & Aila , 2017 ; Xie et al. , 2019 ; Berthelot et al. , 2019 ; Sohn et al. , 2020 ; He et al. , 2020 ; Khosla et al. , 2020 ; Chen et al. , 2020b ) , however , the majority of existing research is geared towards computer vision tasks . The discrete nature of natural language makes it challenging to design effective label-preserving transformations for text sequences that can help improve model generalization ( Hu et al. , 2019 ; Xie et al. , 2019 ) . On the other hand , fine-tuning powerful , over-parameterized language models1 proves to be difficult , especially when there is a limited amount of task-specific data available . It may result in representation collapse ( Aghajanyan et al. , 2020 ) or require special finetuning techniques ( Sun et al. , 2019 ; Hao et al. , 2019 ) . In this work , we aim to take a further step towards finding effective data augmentation strategies through systematic investigation . In essence , data augmentation can be regarded as constructing neighborhoods around a training instance that preserve the ground-truth label . With such a characterization , adversarial training ( Zhu et al. , 2020 ; Jiang et al. , 2020 ; Liu et al. , 2020 ; Cheng et al. , 2020 ) also performs label-preserving transformation in embedding space , and thus is considered as an alternative to data augmentation methods in this work . From this perspective , the goal of developing effective data augmentation strategies can be summarized as answering three fundamental questions : i ) What are some label-preserving transformations , that can be applied to text , to compose useful augmented samples ? ∗Work was done during an internship at Microsoft Dynamics 365 AI . 1To name a few , BERT ( Devlin et al. , 2019 ) : 340M parameters , T5 ( Raffel et al. , 2019 ) : 11B parameters , GPT-3 ( Brown et al. , 2020 ) : 175B parameters . ii ) Are these transformations complementary in nature , and can we find some strategies to consolidate them for producing more diverse augmented examples ? iii ) How can we incorporate the obtained augmented samples into the training process in an effective and principled manner ? Previous efforts in augmenting text data were mainly focused on answering the first question ( Yu et al. , 2018 ; Xie et al. , 2019 ; Kumar et al. , 2019 ; Wei & Zou , 2019 ; Chen et al. , 2020a ; Shen et al. , 2020 ) . Regarding the second question , different label-preserving transformations have been proposed , but it remains unclear how to integrate them organically . In addition , it has been shown that the diversity of augmented samples plays a vital role in their effectiveness ( Xie et al. , 2019 ; Gontijo-Lopes et al. , 2020 ) . In the case of image data , several strategies that combine different augmentation methods have been proposed , such as applying multiple transformations sequentially ( Cubuk et al. , 2018 ; 2020 ; Hendrycks et al. , 2020 ) , learning data augmentation policies ( Cubuk et al. , 2018 ) , randomly sampling operations for each data point ( Cubuk et al. , 2020 ) . However , these methods can not be naively applied to text data , since the semantic meanings of a sentence are much more sensitive to local perturbations ( relative to an image ) . As for the third question , consistency training is typically employed to utilize the augmented samples ( Laine & Aila , 2017 ; Hendrycks et al. , 2020 ; Xie et al. , 2019 ; Sohn et al. , 2020 ; Miyato et al. , 2018 ) . This method encourages the model predictions to be invariant to certain label-preserving transformations . However , existing approaches only examine a pair of original and augmented samples in isolation , without considering other examples in the entire training set . As a result , the representation of an augmented sample may be closer to those of other training instances , rather than the one it is derived from . Based on this observation , we advocate that , in addition to consistency training , a training objective that can globally capture the intrinsic relationship within the entire set of original and augmented training instances can help leverage augmented examples more effectively . In this paper , we introduce a novel Contrast-enhanced and Diversity-promoting Data Augmentation ( CoDA ) framework for natural language understanding . To improve the diversity of augmented samples , we extensively explore different combinations of isolated label-preserving transformations in an unified approach . We find that stacking distinct label-preserving transformations produces particularly informative samples . Specifically , the most diverse and high-quality augmented samples are obtained by stacking an adversarial training module over the back-translation transformation . Besides the consistency-regularized loss for repelling the model to behave consistently within local neighborhoods , we propose a contrastive learning objective to capture the global relationship among the data points in the representation space . We evaluate CoDA on the GLUE benchmark ( with RoBERTa ( Liu et al. , 2019 ) as the testbed ) , and CoDA consistently improves the generalization ability of resulting models and gives rise to significant gains relative to the standard fine-tuning procedure . Moreover , our method also outperforms various single data augmentation operations , combination schemes , and other strong baselines . Additional experiments in the low-resource settings and ablation studies further demonstrate the effectiveness of this framework . 2 METHOD . In this section , we focus our discussion on the natural language understanding ( NLU ) tasks , and particularly , under a text classification scenario . However , the proposed data augmentation framework can be readily extended to other NLP tasks as well . 2.1 BACKGROUND : DATA AUGMENTATION AND ADVERSARIAL TRAINING . Data Augmentation Let D = { xi , yi } i=1 ... N denote the training dataset , where the input example xi is a sequence of tokens , and yi is the corresponding label . To improve model ’ s robustness and generalization ability , several data augmentation techniques ( e.g. , back-translation ( Sennrich et al. , 2016 ; Edunov et al. , 2018 ; Xie et al. , 2019 ) , mixup ( Guo et al. , 2019 ) , c-BERT ( Wu et al. , 2019 ) ) have been proposed . Concretely , label-preserving transformations are performed ( on the original training sequences ) to synthesize a collection of augmented samples , denoted by D′ = { x′i , y′i } i=1 ... N . Thus , a model can learn from both the training set D and the augmented set D′ , with pθ ( · ) the predicted output distribution of the model parameterized by θ : θ∗ = arg min θ ∑ ( xi , yi ) ∈D L ( pθ ( xi ) , yi ) + ∑ ( x′i , y ′ i ) ∈D′ L ( pθ ( x ′ i ) , y ′ i ) ( 1 ) Several recent research efforts were focused on encouraging model predictions to be invariant to stochastic or domain-specific data transformations ( Xie et al. , 2019 ; Laine & Aila , 2017 ; Tarvainen & Valpola , 2017 ; Sohn et al. , 2020 ; Miyato et al. , 2018 ; Jiang et al. , 2020 ; Hendrycks et al. , 2020 ) . Take back-translation as example : x′i = BackTrans ( xi ) , then x ′ i is a paraphrase of xi . The model can be regularized to have consistent predictions for ( xi , x′i ) , by minimizing the distribution discrepancyRCS ( pθ ( xi ) , pθ ( x′i ) ) , which typically adopts KL divergence ( see Fig . 1a ) . Adversarial Training In another line , adversarial training methods are applied to text data ( Zhu et al. , 2020 ; Jiang et al. , 2020 ; Cheng et al. , 2020 ; Aghajanyan et al. , 2020 ) for improving model ’ s robustness . Compared with data augmentation techniques , adversarial training requires no domain knowledge to generate additional training examples . Instead , it relies on the model itself to produce adversarial examples which the model are most likely to make incorrect predictions . Similar to data augmentation , adversarial training also typically utilizes the cross-entropy and consistencybased objectives for training . As the two most popular adversarial-training-based algorithms , the adversarial loss ( Goodfellow et al. , 2015 ) ( Eqn . 2 ) and virtual adversarial loss ( Miyato et al. , 2018 ) ( Eqn . 3 ) can be expressed as follows ( see Fig . 1b ) : RAT ( xi , x̃i , yi ) = L ( pθ ( x̃i ) , yi ) , s.t. , ‖x̃i − xi‖ ≤ , ( 2 ) RVAT ( xi , x̃i ) = RCS ( pθ ( x̃i ) , pθ ( xi ) ) , s.t. , ‖x̃i − xi‖ ≤ . ( 3 ) Generally , there is no closed-form to obtain the exact adversarial example x̂i in either Eqn . 2 or 3 . However , it usually can be approximated by a low-order approximation of the objective function with respect to xi . For example , the adversarial example in Eqn . 2 can be approximated by : x̂i ≈ xi + g ‖g‖2 , where g = ∇xiL ( pθ ( xi ) , yi ) . ( 4 ) 2.2 DIVERSITY-PROMOTING CONSISTENCY TRAINING . As discussed in the previous section , data augmentation and adversarial training share the same intuition of producing neighbors around the original training instances . Moreover , both approaches share very similar training objectives . Therefore , it is natural to ask the following question : are different data augmentation methods and adversarial training equal in nature ? Otherwise , are they complementary to each other , and thus can be consolidated together to further improve the model ’ s generalization ability ? Notably , it has been shown , in the CV domain , that combining different data augmentation operations could lead to more diverse augmented examples ( Cubuk et al. , 2018 ; 2020 ; Hendrycks et al. , 2020 ) . However , this is especially challenging for natural language , given that the semantics of a sentence can be entirely altered by slight perturbations . To answer the above question , we propose several distinct strategies to combine different data transformations , with the hope to produce more diverse and informative augmented examples . Specifically , we consider 5 different types of label-preserving transformations : back-translation ( Sennrich et al. , 2016 ; Edunov et al. , 2018 ; Xie et al. , 2019 ) , c-BERT word replacement ( Wu et al. , 2019 ) , mixup ( Guo et al. , 2019 ; Chen et al. , 2020a ) , cutoff ( Shen et al. , 2020 ) , and adversarial training ( Zhu et al. , 2020 ; Jiang et al. , 2020 ) . The 3 combination strategies are schematically illustrated in Figure 2 . For random combination , a particular label-preserving transformation is randomly selected , among all the augmentation operations available , for each mini-batch . As to the mixup interpolation , given two samples xi and xj drawn in a mini-batch , linear interpolation is performed between their input embedding matrices ei and ej ( Zhang et al. , 2017 ) : e′i = aei+ ( 1−a ) ej , where a is the interpolation parameter , usually drawn from a Beta distribution . Moreover , we consider stacking different label-preserving transformations in a sequential manner ( see Figure 2c ) . It is worth noting that due to the discrete nature of text data , some stacking orders are infeasible . For example , it is not reasonable to provide an adversarially-perturbed embedding sequence to the back-translation module . Without loss of generality , we choose the combination where adversarial training is stacked over back-translation to demonstrate the sequential stacking operation ( see Fig . 1c ) . Formally , given a training example ( xi , yi ) , the consistency training objective for such a stacking operation can be written as : x′i = BackTrans ( xi ) , x̂i ≈ argmaxx̃iRAT ( x ′ i , x̃i , yi ) , ( 5 ) Lconsistency ( xi , x̂i , yi ) = L ( pθ ( xi ) , yi ) +αL ( pθ ( x̂i ) , yi ) + βRCS ( pθ ( xi ) , pθ ( x̂i ) ) , ( 6 ) where the first term corresponds to the cross-entropy loss , the second term is the adversarial loss , RCS denotes the consistency loss term between ( xi , x̂i ) . Note that x̂i is obtained through two different label-preserving transformations applied to x , and thus deviates farther from x and should be more diverse than x′i . Inspired by ( Bachman et al. , 2014 ; Zheng et al. , 2016 ; Kannan et al. , 2018 ; Hendrycks et al. , 2020 ) , we employ the Jensen-Shannon divergence forRCS , since it is upper bounded and tends to be more stable and consistent relative to the KL divergence : RCS ( pθ ( xi ) , pθ ( x̂i ) ) = 1 2 ( KL ( pθ ( xi ) ‖M ) + KL ( pθ ( x̂i ) ) ‖M ) ) , ( 7 ) where M = ( pθ ( xi ) + pθ ( x̂i ) ) /2 . Later we simply use x′i to represent the transformed example . 2.3 CONTRASTIVE REGULARIZATION Consistency loss only provides local regularization , i.e. , xi and x′i should have close predictions . However , the relative positions between x′i and other training instances xj ( j 6= i ) have not been examined . In this regard , we propose to leverage a contrastive learning objective to better utilize the augmented examples . Specifically , we assume that the model should encourage an augmented sample x′i to be closer , in the representation space , to its original sample xi , relative to other data points xj ( j 6= i ) in the training set . This is a reasonable assumption since intuitively , the model should be robust enough to successfully determine from which original data an augmented sample is produced . The contrastive learning module is illustrated in Fig . 3 . As demonstrated by prior efforts on contrastive learning , adopting a large batch size is especially vital for its effectiveness ( Chen et al. , 2020b ; Khosla et al. , 2020 ) . Therefore , we introduce a memory bank that stores the history embeddings , thus enabling much larger number of negative samples . Moreover , to avoid the encoder from changing too rapidly ( which may result in inconsistency embeddings ) , a momentum encoder module is incorporated into our algorithm . Concretely , let fθ ( . ) and fθ̄ ( . ) denote the transformation parameterized by the query encoder and key encoder , respectively . Note that θ and θ̄ represent their parameters . The momentum model parameters θ̄ are not learned by gradients . Instead , they are updated through the momentum rule : θ̄ ← γθ̄ + ( 1− γ ) θ at each training step . We omit the details here and refer the interested readers to the work by ( He et al. , 2020 ) for further explanation . Given a sample xi and its augmented example x′i , the query and key can be obtained as follows : qi = fθ ( xi ) , q ′ i = fθ ( x ′ i ) , ki = fθ̄ ( xi ) . ( 8 ) Thus , the contrastive training objective can be written as : Rcontrast ( xi , x′i , M ) = RCT ( qi , ki , M ) +RCT ( q′i , ki , M ) , ( 9 ) RCT ( qi , ki , M ) = −log exp ( sim ( qi , ki ) /τ ) ∑ kj∈M ⋃ { ki } exp ( sim ( qi , kj ) /τ ) , ( 10 ) where τ is the temperature , andM is the memory bank in which the history keys are stored . Cosine similarity is chosen for sim ( · ) . Note that RCT ( q′i , ki , M ) is similarly defined as RCT ( qi , ki , M ) ( with qi replaced by q′i in Eqn . 10 ) . In Eqn . 9 , the first term corresponds to the contrastive loss calculated on the original examples ( self-contrastive loss ) , while the second term is computed on the augmented sample ( augment-contrastive loss ) . Under such a framework , the pair of original and augmented samples are encouraged to stay closer in the learned embedding space , relative to all other training instances . As a result , the model is regularized globally through considering the embeddings of all the training examples available . By integrating both the consistency training objective and the contrastive regularization , the overall training objective for the CoDA framework can be expressed as : θ∗ = argminθ ∑ ( xi , yi ) ∈D Lconsistency ( xi , x′i , yi ) + λRcontrast ( xi , x ′ i , M ) . ( 11 ) where λ is a hyperparameter to be chosen . It is worth noting that the final objective has taken both the local ( consistency loss ) and global ( contrastive loss ) information introduced by the augmented examples into consideration .
The augmentation of NLP samples is an important task with no clear "applicable to all" mechanism. This is in sharp contrast to computer vision where techniques like rotation, modification of hue, saturation as well as umpteen other techniques exist. This work tries to address the issue by proposing a technique that carefully amalgamates multiple previously known approaches to generate diverse label preserving examples. The experimental results on RoBERTa highlight the applicability and importance of this data augmentation approach on the downstream task of text classification (GLUE).
SP:da2bdc7b32660092811416826572a6982cfc6e2c
CoDA: Contrast-enhanced and Diversity-promoting Data Augmentation for Natural Language Understanding
1 INTRODUCTION . Data augmentation approaches have successfully improved large-scale neural-network-based models , ( Laine & Aila , 2017 ; Xie et al. , 2019 ; Berthelot et al. , 2019 ; Sohn et al. , 2020 ; He et al. , 2020 ; Khosla et al. , 2020 ; Chen et al. , 2020b ) , however , the majority of existing research is geared towards computer vision tasks . The discrete nature of natural language makes it challenging to design effective label-preserving transformations for text sequences that can help improve model generalization ( Hu et al. , 2019 ; Xie et al. , 2019 ) . On the other hand , fine-tuning powerful , over-parameterized language models1 proves to be difficult , especially when there is a limited amount of task-specific data available . It may result in representation collapse ( Aghajanyan et al. , 2020 ) or require special finetuning techniques ( Sun et al. , 2019 ; Hao et al. , 2019 ) . In this work , we aim to take a further step towards finding effective data augmentation strategies through systematic investigation . In essence , data augmentation can be regarded as constructing neighborhoods around a training instance that preserve the ground-truth label . With such a characterization , adversarial training ( Zhu et al. , 2020 ; Jiang et al. , 2020 ; Liu et al. , 2020 ; Cheng et al. , 2020 ) also performs label-preserving transformation in embedding space , and thus is considered as an alternative to data augmentation methods in this work . From this perspective , the goal of developing effective data augmentation strategies can be summarized as answering three fundamental questions : i ) What are some label-preserving transformations , that can be applied to text , to compose useful augmented samples ? ∗Work was done during an internship at Microsoft Dynamics 365 AI . 1To name a few , BERT ( Devlin et al. , 2019 ) : 340M parameters , T5 ( Raffel et al. , 2019 ) : 11B parameters , GPT-3 ( Brown et al. , 2020 ) : 175B parameters . ii ) Are these transformations complementary in nature , and can we find some strategies to consolidate them for producing more diverse augmented examples ? iii ) How can we incorporate the obtained augmented samples into the training process in an effective and principled manner ? Previous efforts in augmenting text data were mainly focused on answering the first question ( Yu et al. , 2018 ; Xie et al. , 2019 ; Kumar et al. , 2019 ; Wei & Zou , 2019 ; Chen et al. , 2020a ; Shen et al. , 2020 ) . Regarding the second question , different label-preserving transformations have been proposed , but it remains unclear how to integrate them organically . In addition , it has been shown that the diversity of augmented samples plays a vital role in their effectiveness ( Xie et al. , 2019 ; Gontijo-Lopes et al. , 2020 ) . In the case of image data , several strategies that combine different augmentation methods have been proposed , such as applying multiple transformations sequentially ( Cubuk et al. , 2018 ; 2020 ; Hendrycks et al. , 2020 ) , learning data augmentation policies ( Cubuk et al. , 2018 ) , randomly sampling operations for each data point ( Cubuk et al. , 2020 ) . However , these methods can not be naively applied to text data , since the semantic meanings of a sentence are much more sensitive to local perturbations ( relative to an image ) . As for the third question , consistency training is typically employed to utilize the augmented samples ( Laine & Aila , 2017 ; Hendrycks et al. , 2020 ; Xie et al. , 2019 ; Sohn et al. , 2020 ; Miyato et al. , 2018 ) . This method encourages the model predictions to be invariant to certain label-preserving transformations . However , existing approaches only examine a pair of original and augmented samples in isolation , without considering other examples in the entire training set . As a result , the representation of an augmented sample may be closer to those of other training instances , rather than the one it is derived from . Based on this observation , we advocate that , in addition to consistency training , a training objective that can globally capture the intrinsic relationship within the entire set of original and augmented training instances can help leverage augmented examples more effectively . In this paper , we introduce a novel Contrast-enhanced and Diversity-promoting Data Augmentation ( CoDA ) framework for natural language understanding . To improve the diversity of augmented samples , we extensively explore different combinations of isolated label-preserving transformations in an unified approach . We find that stacking distinct label-preserving transformations produces particularly informative samples . Specifically , the most diverse and high-quality augmented samples are obtained by stacking an adversarial training module over the back-translation transformation . Besides the consistency-regularized loss for repelling the model to behave consistently within local neighborhoods , we propose a contrastive learning objective to capture the global relationship among the data points in the representation space . We evaluate CoDA on the GLUE benchmark ( with RoBERTa ( Liu et al. , 2019 ) as the testbed ) , and CoDA consistently improves the generalization ability of resulting models and gives rise to significant gains relative to the standard fine-tuning procedure . Moreover , our method also outperforms various single data augmentation operations , combination schemes , and other strong baselines . Additional experiments in the low-resource settings and ablation studies further demonstrate the effectiveness of this framework . 2 METHOD . In this section , we focus our discussion on the natural language understanding ( NLU ) tasks , and particularly , under a text classification scenario . However , the proposed data augmentation framework can be readily extended to other NLP tasks as well . 2.1 BACKGROUND : DATA AUGMENTATION AND ADVERSARIAL TRAINING . Data Augmentation Let D = { xi , yi } i=1 ... N denote the training dataset , where the input example xi is a sequence of tokens , and yi is the corresponding label . To improve model ’ s robustness and generalization ability , several data augmentation techniques ( e.g. , back-translation ( Sennrich et al. , 2016 ; Edunov et al. , 2018 ; Xie et al. , 2019 ) , mixup ( Guo et al. , 2019 ) , c-BERT ( Wu et al. , 2019 ) ) have been proposed . Concretely , label-preserving transformations are performed ( on the original training sequences ) to synthesize a collection of augmented samples , denoted by D′ = { x′i , y′i } i=1 ... N . Thus , a model can learn from both the training set D and the augmented set D′ , with pθ ( · ) the predicted output distribution of the model parameterized by θ : θ∗ = arg min θ ∑ ( xi , yi ) ∈D L ( pθ ( xi ) , yi ) + ∑ ( x′i , y ′ i ) ∈D′ L ( pθ ( x ′ i ) , y ′ i ) ( 1 ) Several recent research efforts were focused on encouraging model predictions to be invariant to stochastic or domain-specific data transformations ( Xie et al. , 2019 ; Laine & Aila , 2017 ; Tarvainen & Valpola , 2017 ; Sohn et al. , 2020 ; Miyato et al. , 2018 ; Jiang et al. , 2020 ; Hendrycks et al. , 2020 ) . Take back-translation as example : x′i = BackTrans ( xi ) , then x ′ i is a paraphrase of xi . The model can be regularized to have consistent predictions for ( xi , x′i ) , by minimizing the distribution discrepancyRCS ( pθ ( xi ) , pθ ( x′i ) ) , which typically adopts KL divergence ( see Fig . 1a ) . Adversarial Training In another line , adversarial training methods are applied to text data ( Zhu et al. , 2020 ; Jiang et al. , 2020 ; Cheng et al. , 2020 ; Aghajanyan et al. , 2020 ) for improving model ’ s robustness . Compared with data augmentation techniques , adversarial training requires no domain knowledge to generate additional training examples . Instead , it relies on the model itself to produce adversarial examples which the model are most likely to make incorrect predictions . Similar to data augmentation , adversarial training also typically utilizes the cross-entropy and consistencybased objectives for training . As the two most popular adversarial-training-based algorithms , the adversarial loss ( Goodfellow et al. , 2015 ) ( Eqn . 2 ) and virtual adversarial loss ( Miyato et al. , 2018 ) ( Eqn . 3 ) can be expressed as follows ( see Fig . 1b ) : RAT ( xi , x̃i , yi ) = L ( pθ ( x̃i ) , yi ) , s.t. , ‖x̃i − xi‖ ≤ , ( 2 ) RVAT ( xi , x̃i ) = RCS ( pθ ( x̃i ) , pθ ( xi ) ) , s.t. , ‖x̃i − xi‖ ≤ . ( 3 ) Generally , there is no closed-form to obtain the exact adversarial example x̂i in either Eqn . 2 or 3 . However , it usually can be approximated by a low-order approximation of the objective function with respect to xi . For example , the adversarial example in Eqn . 2 can be approximated by : x̂i ≈ xi + g ‖g‖2 , where g = ∇xiL ( pθ ( xi ) , yi ) . ( 4 ) 2.2 DIVERSITY-PROMOTING CONSISTENCY TRAINING . As discussed in the previous section , data augmentation and adversarial training share the same intuition of producing neighbors around the original training instances . Moreover , both approaches share very similar training objectives . Therefore , it is natural to ask the following question : are different data augmentation methods and adversarial training equal in nature ? Otherwise , are they complementary to each other , and thus can be consolidated together to further improve the model ’ s generalization ability ? Notably , it has been shown , in the CV domain , that combining different data augmentation operations could lead to more diverse augmented examples ( Cubuk et al. , 2018 ; 2020 ; Hendrycks et al. , 2020 ) . However , this is especially challenging for natural language , given that the semantics of a sentence can be entirely altered by slight perturbations . To answer the above question , we propose several distinct strategies to combine different data transformations , with the hope to produce more diverse and informative augmented examples . Specifically , we consider 5 different types of label-preserving transformations : back-translation ( Sennrich et al. , 2016 ; Edunov et al. , 2018 ; Xie et al. , 2019 ) , c-BERT word replacement ( Wu et al. , 2019 ) , mixup ( Guo et al. , 2019 ; Chen et al. , 2020a ) , cutoff ( Shen et al. , 2020 ) , and adversarial training ( Zhu et al. , 2020 ; Jiang et al. , 2020 ) . The 3 combination strategies are schematically illustrated in Figure 2 . For random combination , a particular label-preserving transformation is randomly selected , among all the augmentation operations available , for each mini-batch . As to the mixup interpolation , given two samples xi and xj drawn in a mini-batch , linear interpolation is performed between their input embedding matrices ei and ej ( Zhang et al. , 2017 ) : e′i = aei+ ( 1−a ) ej , where a is the interpolation parameter , usually drawn from a Beta distribution . Moreover , we consider stacking different label-preserving transformations in a sequential manner ( see Figure 2c ) . It is worth noting that due to the discrete nature of text data , some stacking orders are infeasible . For example , it is not reasonable to provide an adversarially-perturbed embedding sequence to the back-translation module . Without loss of generality , we choose the combination where adversarial training is stacked over back-translation to demonstrate the sequential stacking operation ( see Fig . 1c ) . Formally , given a training example ( xi , yi ) , the consistency training objective for such a stacking operation can be written as : x′i = BackTrans ( xi ) , x̂i ≈ argmaxx̃iRAT ( x ′ i , x̃i , yi ) , ( 5 ) Lconsistency ( xi , x̂i , yi ) = L ( pθ ( xi ) , yi ) +αL ( pθ ( x̂i ) , yi ) + βRCS ( pθ ( xi ) , pθ ( x̂i ) ) , ( 6 ) where the first term corresponds to the cross-entropy loss , the second term is the adversarial loss , RCS denotes the consistency loss term between ( xi , x̂i ) . Note that x̂i is obtained through two different label-preserving transformations applied to x , and thus deviates farther from x and should be more diverse than x′i . Inspired by ( Bachman et al. , 2014 ; Zheng et al. , 2016 ; Kannan et al. , 2018 ; Hendrycks et al. , 2020 ) , we employ the Jensen-Shannon divergence forRCS , since it is upper bounded and tends to be more stable and consistent relative to the KL divergence : RCS ( pθ ( xi ) , pθ ( x̂i ) ) = 1 2 ( KL ( pθ ( xi ) ‖M ) + KL ( pθ ( x̂i ) ) ‖M ) ) , ( 7 ) where M = ( pθ ( xi ) + pθ ( x̂i ) ) /2 . Later we simply use x′i to represent the transformed example . 2.3 CONTRASTIVE REGULARIZATION Consistency loss only provides local regularization , i.e. , xi and x′i should have close predictions . However , the relative positions between x′i and other training instances xj ( j 6= i ) have not been examined . In this regard , we propose to leverage a contrastive learning objective to better utilize the augmented examples . Specifically , we assume that the model should encourage an augmented sample x′i to be closer , in the representation space , to its original sample xi , relative to other data points xj ( j 6= i ) in the training set . This is a reasonable assumption since intuitively , the model should be robust enough to successfully determine from which original data an augmented sample is produced . The contrastive learning module is illustrated in Fig . 3 . As demonstrated by prior efforts on contrastive learning , adopting a large batch size is especially vital for its effectiveness ( Chen et al. , 2020b ; Khosla et al. , 2020 ) . Therefore , we introduce a memory bank that stores the history embeddings , thus enabling much larger number of negative samples . Moreover , to avoid the encoder from changing too rapidly ( which may result in inconsistency embeddings ) , a momentum encoder module is incorporated into our algorithm . Concretely , let fθ ( . ) and fθ̄ ( . ) denote the transformation parameterized by the query encoder and key encoder , respectively . Note that θ and θ̄ represent their parameters . The momentum model parameters θ̄ are not learned by gradients . Instead , they are updated through the momentum rule : θ̄ ← γθ̄ + ( 1− γ ) θ at each training step . We omit the details here and refer the interested readers to the work by ( He et al. , 2020 ) for further explanation . Given a sample xi and its augmented example x′i , the query and key can be obtained as follows : qi = fθ ( xi ) , q ′ i = fθ ( x ′ i ) , ki = fθ̄ ( xi ) . ( 8 ) Thus , the contrastive training objective can be written as : Rcontrast ( xi , x′i , M ) = RCT ( qi , ki , M ) +RCT ( q′i , ki , M ) , ( 9 ) RCT ( qi , ki , M ) = −log exp ( sim ( qi , ki ) /τ ) ∑ kj∈M ⋃ { ki } exp ( sim ( qi , kj ) /τ ) , ( 10 ) where τ is the temperature , andM is the memory bank in which the history keys are stored . Cosine similarity is chosen for sim ( · ) . Note that RCT ( q′i , ki , M ) is similarly defined as RCT ( qi , ki , M ) ( with qi replaced by q′i in Eqn . 10 ) . In Eqn . 9 , the first term corresponds to the contrastive loss calculated on the original examples ( self-contrastive loss ) , while the second term is computed on the augmented sample ( augment-contrastive loss ) . Under such a framework , the pair of original and augmented samples are encouraged to stay closer in the learned embedding space , relative to all other training instances . As a result , the model is regularized globally through considering the embeddings of all the training examples available . By integrating both the consistency training objective and the contrastive regularization , the overall training objective for the CoDA framework can be expressed as : θ∗ = argminθ ∑ ( xi , yi ) ∈D Lconsistency ( xi , x′i , yi ) + λRcontrast ( xi , x ′ i , M ) . ( 11 ) where λ is a hyperparameter to be chosen . It is worth noting that the final objective has taken both the local ( consistency loss ) and global ( contrastive loss ) information introduced by the augmented examples into consideration .
Paper proposes a contrastive learning-based approach to combine different data augmentation techniques for NLP tasks. While the widely used consistency loss focuses on a single example, the proposed contrastive objective allows capturing the relationships among all data samples which helps in producing diverse and informative examples. For experiments, the paper explores 5 data augmentation approaches with Roberta-large as the classification model. Empirical results on the standard GLUE benchmark leads to an impressive 2.2% average improvement. Authors also found that back-translation and adversarial training combination leads to better performance than other DA combinations.
SP:da2bdc7b32660092811416826572a6982cfc6e2c
PIVEN: A Deep Neural Network for Prediction Intervals with Specific Value Prediction
1 INTRODUCTION . Deep neural networks ( DNNs ) have been achieving state-of-the-art results in a large variety of complex problems . These include automated decision making and recommendation systems in the medical domain ( Razzak et al. , 2018 ) , autonomous control of drones ( Kaufmann et al. , 2018 ) and self driving cars ( Bojarski et al. , 2016 ) . In many of these domains , it is crucial not only that the prediction made by the DNN is accurate , but rather that its uncertainty is quantified . Quantifying uncertainty has many benefits , including risk reduction and more reliable planning ( Khosravi et al. , 2010 ) . In regression , uncertainty is quantified using prediction intervals ( PIs ) , which offer upper and lower bounds on the value of a data point for a given probability ( e.g. , 95 % ) . Existing non-Bayesian PI generation methods can be roughly divided into two groups : a ) performing multiple runs of the regression problem , as in dropout ( Gal & Ghahramani , 2016 ) or ensemble-based methods ( Lakshminarayanan et al. , 2017 ) , then deriving post-hoc the PI from prediction variance , and ; b ) dedicated architectures for the PI generation ( Pearce et al. , 2018 ; Tagasovska & Lopez-Paz , 2019 ) . While effective , both approaches have shortcomings . On the one hand , the former group is not optimized for PIs generation , having to convert a set of sampled values into a distribution . This lack of PI optimization makes using these approaches difficult in domains such as financial risk mitigation or scheduling . For example , providing a PI for the number of days a machine can function without malfunctioning ( e.g. , 30-45 days with 99 % certainty ) is more valuable than a prediction for the specific time of failure . On the other hand , the latter group—PI-dedicated architectures —provides accurate upper and lower bounds for the prediction , but lacks in the accuracy of its value predictions . Consequently , these approaches select the middle of the interval as their value prediction , which is ( as we later demonstrate ) a sub-optimal strategy that makes assumptions regarding the value distribution within the interval . The shortcomings of PI-dedicated architectures with regard to value prediction are supported both by Pearce et al . ( 2018 ) and by our experiments in Section 5 . We propose PIVEN ( prediction intervals with specific value prediction ) , a novel approach for simultaneous PI generation and value prediction using DNNs . Our approach combines the benefits of both above-mentioned groups by producing both a PI and a value prediction , while ensuring that the latter is within the former . We follow the experimental procedure of recent works , and compare our approach to current best-performing methods : Quality-Driven PI ( QD ) by Pearce et al . ( 2018 ) ( a dedicated PI generation method ) , and Deep Ensembles ( DE ) by DeepMind ( Lakshminarayanan et al. , 2017 ) . Our results show that PIVEN outperforms QD by producing narrower PIs , while simultaneously achieving comparable results to DE in terms of value prediction . Additional analysis on large image datasets and synthetic data shows that PIVEN performs well on skewed value distributions and can be effectively combined with pre-trained DNN architectures . 2 RELATED WORK . Modeling uncertainty in deep learning has been an active area of research in recent years ( Pearce et al. , 2018 ; Qiu et al. , 2019 ; Gal & Ghahramani , 2016 ; Lakshminarayanan et al. , 2017 ; Keren et al. , 2018 ; Kendall & Gal , 2017 ; Geifman et al. , 2018 ; Ovadia et al. , 2019 ) . Studies in uncertainty modeling and regression can be generally divided into two groups : PI-based and non-PI-based . Non-PI approaches utilize both Bayesian ( MacKay , 1992 ) and non-Bayesian approaches . The former methods define a prior distribution on the weights and biases of a neural net ( NN ) , while inferring a posterior distribution from the training data . Non-Bayesian methods ( Gal & Ghahramani , 2016 ; Lakshminarayanan et al. , 2017 ; Qiu et al. , 2019 ) do not use initial prior distributions . In ( Gal & Ghahramani , 2016 ) , Monte Carlo sampling was used to estimate the predictive uncertainty of NNs through the use of dropout over multiple runs . A later study ( Lakshminarayanan et al. , 2017 ) employed a combination of ensemble learning and adversarial training to quantify model uncertainty . In an expansion of a previously-proposed approach ( Nix & Weigend , 1994 ) , each NN was optimized to learn the mean and variance of the data , assuming a Gaussian distribution . Recently , Qiu et al . ( 2019 ) proposed a post-hoc procedure using Gaussian processes to measure uncertainty . PI-based approaches are designed to produce a PI for each sample . Keren et al . ( 2018 ) propose a post-processing approach that considers the regression problem as one of classification , and uses the output of the final softmax layer to produce PIs . Tagasovska & Lopez-Paz ( 2019 ) propose the use of a loss function designed to learn all conditional quantiles of a given target variable . LUBE ( Khosravi et al. , 2010 ) consists of a loss function optimized for the creation of PIs , but has the caveat of not being able to use stochastic gradient descent ( SGD ) for its optimization . A recent study ( Pearce et al. , 2018 ) inspired by LUBE , proposed a loss function that is both optimized for the generation of PIs and can be optimized using SGD . Each of the two groups presented above tends to under-perform when applied to tasks for which its loss function was not optimized : Non-PI approaches produce more accurate value predictions , but are not optimized to produce PI and therefore produce bounds that are less tight . PI-based methods produce tight bounds , but tend to underperform when producing value predictions. . Recent studies ( Kivaranovic et al. , 2019 ; Romano et al. , 2019 ) attempted to produce both value predictions and PIs by using conformal prediction with quantile regression . While effective , these methods use a complex splitting strategy , where one part of the data is used to produce value predictions and PIs , while the the other part is to further adjust the PIs . Recently , Salem et al . ( 2020 ) proposed a method for combining the two , together with post-hoc optimization . Contrary to these approaches , PIVEN produces PIs with value predictions in an end-to-end manner by relying on a novel loss function . 3 PROBLEM FORMULATION . In this work we consider a neural network regressor that processes an input x ∈ X with an associated label y ∈ R , where X can be any feature space ( e.g. , tabular data , age prediction from images ) . Let ( xi , yi ) ∈ X × R be a data point along with its target value . Let Ui and Li be the upper and lower bounds of PIs corresponding to the ith sample . Our goal is to construct ( Li , Ui , yi ) so that Pr ( Li ≤ yi ≤ Ui ) ≥ 1− α . We refer to 1− α as the confidence level of the PI . We define two quantitative measures for the evaluation of PIs , as defined in Khosravi et al . ( 2010 ) . First , we define coverage as the ratio of dataset samples that fall within their respective PIs . We measure coverage using the prediction interval coverage probability ( PICP ) metric : PICP : = 1 n n∑ i=1 ki ( 1 ) where n denotes the number of samples and ki = 1 if yi ∈ ( Li , Ui ) , otherwise ki = 0 . Next , we define a quality metric for the generated PIs with the goal of producing as tight a bound as possible while maintaining adequate coverage . We define the mean prediction interval width ( MPIW ) as , MPIW : = 1 n n∑ i=1 Ui − Li ( 2 ) When combined , these metrics enable us to comprehensively evaluate the quality of generated PIs . 4 METHOD . 4.1 SYSTEM ARCHITECTURE . The proposed architecture is presented in Figure 1 . It consists of three components : Backbone block . The main body block , consisting of a varying number of DNN layers or sub-blocks . The goal of this component is to transform the input into a latent representation that is then provided as input to the other components . It is important to note that PIVEN supports any architecture type ( e.g. , dense , convolutions ) that can be applied to a regression problem . Moreover , pre-trained architectures can also be used very easily , with PIVEN being added on top of the architecture for an additional short training . For example , we use pre-trained VGG-16 and DenseNet architectures in our experiments . Upper & lower-bound heads . L ( x ) and U ( x ) produce the lower and upper bounds of the PI respectively , such that Pr ( L ( x ) ≤ y ( x ) ≤ U ( x ) ) ≥ 1− α where y ( x ) is the value prediction and 1− α is the predefined confidence level . Auxiliary head . The auxiliary prediction head , v ( x ) , enables us to produce a value prediction . v ( x ) does not produce the value prediction directly , but rather produces the relative weight that should be given to each of the two bounds . We define the value prediction using , y = v · U + ( 1− v ) · L ( 3 ) where v ∈ ( 0 , 1 ) . By expressing y as a function of U and L , we ( a ) bound them together and improve their performance ( see Section 4.4 ) , and ; ( b ) ensure that the value prediction falls within the PI . The goal of the loss function of our approach , denoted as LPIV EN , is to balance two conflicting goals : generating tight PIs and producing accurate value predictions . LPIV EN achieves this goal by synchronizing two loss functions that are designed to assess each of the two goals described above . 4.2 NETWORK OPTIMIZATION . Our goal is to generate narrow PIs , measured by MPIW , while maintaining the desired level of coverage PICP = 1− α . However , PIs that fail to capture their respective data point should not be encouraged to shrink further . We follow the derivation presented in Pearce et al . ( 2018 ) and define captured MPIW ( MPIWcapt ) as the MPIW of only those points for which Li ≤ yi ≤ Ui , MPIWcapt : = 1 c n∑ i=1 ( Ui − Li ) · ki ( 4 ) where c = ∑n i=1 ki . Hence , we seek to minimize MPIWcapt subject to PICP ≥ 1− α : θ∗ = arg min θ ( MPIWcapt , θ ) s.t PICPθ ≥ 1− α where θ is the parameters of the neural net . To enforce the coverage constraint , we utilize a variant of the well-known Interior Point Method ( Potra & Wright , 2000 ) , resulting in an unconstrained loss : LPI = MPIWcapt , θ + √ n · λΨ ( 1− α− PICPθ ) Ψ ( x ) : = max ( 0 , x ) 2 where Ψ is a quadratic penalty function , n is the batch size which was included because a larger sample size would increase confidence in the value of PICP ( thus increasing the loss ) and λ is a hyperparameter controlling the relative importance of width vs. coverage . We use a default value of λ = 15 in all our experiments , and perform further analyze of this parameter in Section 6.3 In practice , optimizing the loss with a discrete version of k ( see eq . 4 ) fails to converge , because the gradient is always positive for all possible values . We therefore define a continuous version of k , denoted as ksoft = σ ( s · ( y− L ) ) σ ( s · ( U− y ) ) , where σ is the sigmoid function , and s > 0 is a softening factor . The final version of LPI uses the continuous and discrete versions of k in its calculations of the PICP and MPIWcapt metrics , respectively . The discrete k enables us to assign a score of zero to points outside the interval , while ksoft produces continuous values that enable gradient calculations . Neural networks optimized by the abovementioned objective are able to generate well-calibrated PIs . However , they have two significant drawbacks—overfitting , and lack of value prediction capabilities . Overfitting . The MPIWcapt term in LPI focuses only on the fraction c of the training set where the data points are successfully captured by the PI . As a result , the network is likely to overfit to a subset of the data on which it was able to perform well in the first place . Our reasoning is supported by our experiments in sections 5 and 6 . Lack of value prediction capabilities . In its current form , LPI is not able to perform value prediction , i.e. , returning accurate prediction for the regression problem . To overcome this limitation , one can return the middle of the PI , as done in Pearce et al . ( 2018 ) and Tagasovska & Lopez-Paz ( 2019 ) . This approach performs well only if the dataset value distribution is uniform or Gaussian ( i.e. , where choosing the mean minimizes prediction loss ) . For skewed distributions , as is often the case in the real world , this approach leads to sub-optimal results , as we show in Section 5.4 . We propose a novel loss function that combines the generation of both PIs and value predictions . To optimize the output of v ( x ) ( the auxiliary head ) , we minimize the standard regression loss , Lv = 1 n n∑ i=1 ` ( vi · Ui + ( 1− vi ) · Li , yi ) ( 5 ) where ` is a regression objective against the ground-truth . Our final loss function is a convex combination of LPI , and the auxiliary loss Lv . Thus , the overall training objective is : LPIV EN = βLPI + ( 1− β ) Lv ( 6 ) where β is a hyperparameter that balances the two goals of our approach : producing narrow PIs and accurate value predictions . In all our experiments , we chose to assign equal priorities to both goals by setting β = 0.5 . We performed no hyperparameter optimization .
This paper proposes a new objective function for training regression networks with prediction intervals. The goal is to provide tight confidence bounds to accompany predictions, which is of course important for practical deployments of ML systems where uncertainty quantification is critical. Previous work has largely assumed that uncertainty is symmetrical, or even Gaussian distributed, which is often not the case in practice. The innovation of this work is to simultaneously predict the bounds for a given confidence level and a point prediction within those bounds, which is not necessarily the mean. It is accomplished by predicting 3 values: an upper bound, a lower bound, and a mixing parameter that allows making the point estimate as a weighted sum of the bounds. Experimental results are provided on 3 datasets, with 2 baseline methods compared against.
SP:0423364bd06f7fe3ef17328f83a5eb99db6459af
PIVEN: A Deep Neural Network for Prediction Intervals with Specific Value Prediction
1 INTRODUCTION . Deep neural networks ( DNNs ) have been achieving state-of-the-art results in a large variety of complex problems . These include automated decision making and recommendation systems in the medical domain ( Razzak et al. , 2018 ) , autonomous control of drones ( Kaufmann et al. , 2018 ) and self driving cars ( Bojarski et al. , 2016 ) . In many of these domains , it is crucial not only that the prediction made by the DNN is accurate , but rather that its uncertainty is quantified . Quantifying uncertainty has many benefits , including risk reduction and more reliable planning ( Khosravi et al. , 2010 ) . In regression , uncertainty is quantified using prediction intervals ( PIs ) , which offer upper and lower bounds on the value of a data point for a given probability ( e.g. , 95 % ) . Existing non-Bayesian PI generation methods can be roughly divided into two groups : a ) performing multiple runs of the regression problem , as in dropout ( Gal & Ghahramani , 2016 ) or ensemble-based methods ( Lakshminarayanan et al. , 2017 ) , then deriving post-hoc the PI from prediction variance , and ; b ) dedicated architectures for the PI generation ( Pearce et al. , 2018 ; Tagasovska & Lopez-Paz , 2019 ) . While effective , both approaches have shortcomings . On the one hand , the former group is not optimized for PIs generation , having to convert a set of sampled values into a distribution . This lack of PI optimization makes using these approaches difficult in domains such as financial risk mitigation or scheduling . For example , providing a PI for the number of days a machine can function without malfunctioning ( e.g. , 30-45 days with 99 % certainty ) is more valuable than a prediction for the specific time of failure . On the other hand , the latter group—PI-dedicated architectures —provides accurate upper and lower bounds for the prediction , but lacks in the accuracy of its value predictions . Consequently , these approaches select the middle of the interval as their value prediction , which is ( as we later demonstrate ) a sub-optimal strategy that makes assumptions regarding the value distribution within the interval . The shortcomings of PI-dedicated architectures with regard to value prediction are supported both by Pearce et al . ( 2018 ) and by our experiments in Section 5 . We propose PIVEN ( prediction intervals with specific value prediction ) , a novel approach for simultaneous PI generation and value prediction using DNNs . Our approach combines the benefits of both above-mentioned groups by producing both a PI and a value prediction , while ensuring that the latter is within the former . We follow the experimental procedure of recent works , and compare our approach to current best-performing methods : Quality-Driven PI ( QD ) by Pearce et al . ( 2018 ) ( a dedicated PI generation method ) , and Deep Ensembles ( DE ) by DeepMind ( Lakshminarayanan et al. , 2017 ) . Our results show that PIVEN outperforms QD by producing narrower PIs , while simultaneously achieving comparable results to DE in terms of value prediction . Additional analysis on large image datasets and synthetic data shows that PIVEN performs well on skewed value distributions and can be effectively combined with pre-trained DNN architectures . 2 RELATED WORK . Modeling uncertainty in deep learning has been an active area of research in recent years ( Pearce et al. , 2018 ; Qiu et al. , 2019 ; Gal & Ghahramani , 2016 ; Lakshminarayanan et al. , 2017 ; Keren et al. , 2018 ; Kendall & Gal , 2017 ; Geifman et al. , 2018 ; Ovadia et al. , 2019 ) . Studies in uncertainty modeling and regression can be generally divided into two groups : PI-based and non-PI-based . Non-PI approaches utilize both Bayesian ( MacKay , 1992 ) and non-Bayesian approaches . The former methods define a prior distribution on the weights and biases of a neural net ( NN ) , while inferring a posterior distribution from the training data . Non-Bayesian methods ( Gal & Ghahramani , 2016 ; Lakshminarayanan et al. , 2017 ; Qiu et al. , 2019 ) do not use initial prior distributions . In ( Gal & Ghahramani , 2016 ) , Monte Carlo sampling was used to estimate the predictive uncertainty of NNs through the use of dropout over multiple runs . A later study ( Lakshminarayanan et al. , 2017 ) employed a combination of ensemble learning and adversarial training to quantify model uncertainty . In an expansion of a previously-proposed approach ( Nix & Weigend , 1994 ) , each NN was optimized to learn the mean and variance of the data , assuming a Gaussian distribution . Recently , Qiu et al . ( 2019 ) proposed a post-hoc procedure using Gaussian processes to measure uncertainty . PI-based approaches are designed to produce a PI for each sample . Keren et al . ( 2018 ) propose a post-processing approach that considers the regression problem as one of classification , and uses the output of the final softmax layer to produce PIs . Tagasovska & Lopez-Paz ( 2019 ) propose the use of a loss function designed to learn all conditional quantiles of a given target variable . LUBE ( Khosravi et al. , 2010 ) consists of a loss function optimized for the creation of PIs , but has the caveat of not being able to use stochastic gradient descent ( SGD ) for its optimization . A recent study ( Pearce et al. , 2018 ) inspired by LUBE , proposed a loss function that is both optimized for the generation of PIs and can be optimized using SGD . Each of the two groups presented above tends to under-perform when applied to tasks for which its loss function was not optimized : Non-PI approaches produce more accurate value predictions , but are not optimized to produce PI and therefore produce bounds that are less tight . PI-based methods produce tight bounds , but tend to underperform when producing value predictions. . Recent studies ( Kivaranovic et al. , 2019 ; Romano et al. , 2019 ) attempted to produce both value predictions and PIs by using conformal prediction with quantile regression . While effective , these methods use a complex splitting strategy , where one part of the data is used to produce value predictions and PIs , while the the other part is to further adjust the PIs . Recently , Salem et al . ( 2020 ) proposed a method for combining the two , together with post-hoc optimization . Contrary to these approaches , PIVEN produces PIs with value predictions in an end-to-end manner by relying on a novel loss function . 3 PROBLEM FORMULATION . In this work we consider a neural network regressor that processes an input x ∈ X with an associated label y ∈ R , where X can be any feature space ( e.g. , tabular data , age prediction from images ) . Let ( xi , yi ) ∈ X × R be a data point along with its target value . Let Ui and Li be the upper and lower bounds of PIs corresponding to the ith sample . Our goal is to construct ( Li , Ui , yi ) so that Pr ( Li ≤ yi ≤ Ui ) ≥ 1− α . We refer to 1− α as the confidence level of the PI . We define two quantitative measures for the evaluation of PIs , as defined in Khosravi et al . ( 2010 ) . First , we define coverage as the ratio of dataset samples that fall within their respective PIs . We measure coverage using the prediction interval coverage probability ( PICP ) metric : PICP : = 1 n n∑ i=1 ki ( 1 ) where n denotes the number of samples and ki = 1 if yi ∈ ( Li , Ui ) , otherwise ki = 0 . Next , we define a quality metric for the generated PIs with the goal of producing as tight a bound as possible while maintaining adequate coverage . We define the mean prediction interval width ( MPIW ) as , MPIW : = 1 n n∑ i=1 Ui − Li ( 2 ) When combined , these metrics enable us to comprehensively evaluate the quality of generated PIs . 4 METHOD . 4.1 SYSTEM ARCHITECTURE . The proposed architecture is presented in Figure 1 . It consists of three components : Backbone block . The main body block , consisting of a varying number of DNN layers or sub-blocks . The goal of this component is to transform the input into a latent representation that is then provided as input to the other components . It is important to note that PIVEN supports any architecture type ( e.g. , dense , convolutions ) that can be applied to a regression problem . Moreover , pre-trained architectures can also be used very easily , with PIVEN being added on top of the architecture for an additional short training . For example , we use pre-trained VGG-16 and DenseNet architectures in our experiments . Upper & lower-bound heads . L ( x ) and U ( x ) produce the lower and upper bounds of the PI respectively , such that Pr ( L ( x ) ≤ y ( x ) ≤ U ( x ) ) ≥ 1− α where y ( x ) is the value prediction and 1− α is the predefined confidence level . Auxiliary head . The auxiliary prediction head , v ( x ) , enables us to produce a value prediction . v ( x ) does not produce the value prediction directly , but rather produces the relative weight that should be given to each of the two bounds . We define the value prediction using , y = v · U + ( 1− v ) · L ( 3 ) where v ∈ ( 0 , 1 ) . By expressing y as a function of U and L , we ( a ) bound them together and improve their performance ( see Section 4.4 ) , and ; ( b ) ensure that the value prediction falls within the PI . The goal of the loss function of our approach , denoted as LPIV EN , is to balance two conflicting goals : generating tight PIs and producing accurate value predictions . LPIV EN achieves this goal by synchronizing two loss functions that are designed to assess each of the two goals described above . 4.2 NETWORK OPTIMIZATION . Our goal is to generate narrow PIs , measured by MPIW , while maintaining the desired level of coverage PICP = 1− α . However , PIs that fail to capture their respective data point should not be encouraged to shrink further . We follow the derivation presented in Pearce et al . ( 2018 ) and define captured MPIW ( MPIWcapt ) as the MPIW of only those points for which Li ≤ yi ≤ Ui , MPIWcapt : = 1 c n∑ i=1 ( Ui − Li ) · ki ( 4 ) where c = ∑n i=1 ki . Hence , we seek to minimize MPIWcapt subject to PICP ≥ 1− α : θ∗ = arg min θ ( MPIWcapt , θ ) s.t PICPθ ≥ 1− α where θ is the parameters of the neural net . To enforce the coverage constraint , we utilize a variant of the well-known Interior Point Method ( Potra & Wright , 2000 ) , resulting in an unconstrained loss : LPI = MPIWcapt , θ + √ n · λΨ ( 1− α− PICPθ ) Ψ ( x ) : = max ( 0 , x ) 2 where Ψ is a quadratic penalty function , n is the batch size which was included because a larger sample size would increase confidence in the value of PICP ( thus increasing the loss ) and λ is a hyperparameter controlling the relative importance of width vs. coverage . We use a default value of λ = 15 in all our experiments , and perform further analyze of this parameter in Section 6.3 In practice , optimizing the loss with a discrete version of k ( see eq . 4 ) fails to converge , because the gradient is always positive for all possible values . We therefore define a continuous version of k , denoted as ksoft = σ ( s · ( y− L ) ) σ ( s · ( U− y ) ) , where σ is the sigmoid function , and s > 0 is a softening factor . The final version of LPI uses the continuous and discrete versions of k in its calculations of the PICP and MPIWcapt metrics , respectively . The discrete k enables us to assign a score of zero to points outside the interval , while ksoft produces continuous values that enable gradient calculations . Neural networks optimized by the abovementioned objective are able to generate well-calibrated PIs . However , they have two significant drawbacks—overfitting , and lack of value prediction capabilities . Overfitting . The MPIWcapt term in LPI focuses only on the fraction c of the training set where the data points are successfully captured by the PI . As a result , the network is likely to overfit to a subset of the data on which it was able to perform well in the first place . Our reasoning is supported by our experiments in sections 5 and 6 . Lack of value prediction capabilities . In its current form , LPI is not able to perform value prediction , i.e. , returning accurate prediction for the regression problem . To overcome this limitation , one can return the middle of the PI , as done in Pearce et al . ( 2018 ) and Tagasovska & Lopez-Paz ( 2019 ) . This approach performs well only if the dataset value distribution is uniform or Gaussian ( i.e. , where choosing the mean minimizes prediction loss ) . For skewed distributions , as is often the case in the real world , this approach leads to sub-optimal results , as we show in Section 5.4 . We propose a novel loss function that combines the generation of both PIs and value predictions . To optimize the output of v ( x ) ( the auxiliary head ) , we minimize the standard regression loss , Lv = 1 n n∑ i=1 ` ( vi · Ui + ( 1− vi ) · Li , yi ) ( 5 ) where ` is a regression objective against the ground-truth . Our final loss function is a convex combination of LPI , and the auxiliary loss Lv . Thus , the overall training objective is : LPIV EN = βLPI + ( 1− β ) Lv ( 6 ) where β is a hyperparameter that balances the two goals of our approach : producing narrow PIs and accurate value predictions . In all our experiments , we chose to assign equal priorities to both goals by setting β = 0.5 . We performed no hyperparameter optimization .
The submission considers the continuous real-valued regression problems and how to obtain accurate point predictions (specific value prediction in the text) and prediction intervals (the uncertainty of the predictions, given by [lower bound LB, upper bound UB]). The paper proposes a loss function which is the weighted combination of (i) the coverage constraint [proportion of outputs that fall between LB and UB] so that the coverage meets a required level, (ii) the prediction interval width [for those that satisfy (i), their prediction intervals should be tight], and (iii) the prediction loss [which makes sure the predictions match the outputs]. The LB, UB and predictions are parameterised using three separate heads: one for LB, one for UB and one for the prediction weight (which makes sure the prediction stays in between LB and UB. The proposed loss function and parameterisation architecture are evaluated on UCI regression datasets and two age prediction problems using image inputs.
SP:0423364bd06f7fe3ef17328f83a5eb99db6459af
Differentiate Everything with a Reversible Domain-Specific Language
1 Introduction Most of the popular automatic differentiation ( AD ) tools in the market , such as TensorFlow ( Abadi et al. , 2015 ) , Pytorch ( Paszke et al. , 2017 ) , and Flux ( Innes et al. , 2018 ) implements reverse mode AD at the tensor level to meet the need in machine learning . Later , People in the scientific computing domain also realized the power of these AD tools , they use these tools to solve scientific problems such as seismic inversion ( Zhu et al. , 2020 ) , variational quantum circuits simulation ( Bergholm et al. , 2018 ; Luo et al. , 2019 ) and variational tensor network simulation ( Liao et al. , 2019 ; Roberts et al. , 2019 ) . To meet the diverse need in these applications , one sometimes has to define backward rules manually , for example 1 . To differentiate sparse matrix operations used in Hamiltonian engineering ( Hao Xie & Wang ) , people defined backward rules for sparse matrix multiplication and dominant eigensolvers ( Golub & Van Loan , 2012 ) , 2 . In tensor network algorithms to study the phase transition problem ( Liao et al. , 2019 ; Seeger et al. , 2017 ; Wan & Zhang , 2019 ; Hubig , 2019 ) , people defined backward rules for singular value decomposition ( SVD ) function and QR decomposition ( Golub & Van Loan , 2012 ) . Instead of defining backward rules manually , one can also use a general purposed AD ( GP-AD ) framework like Tapenade ( Hascoet & Pascual , 2013 ) , OpenAD ( Utke et al. , 2008 ) and Zygote ( Innes , 2018 ; Innes et al. , 2019 ) . Researchers have used these tools in practical applications such as bundle adjustment ( Shen & Dai , 2018 ) and earth system simulation ( Forget et al. , 2015 ) , where differentiating scalar operations is important . However , the power of these tools are often limited by their relatively poor performance . In many practical applications , a program might do billions of computations . In each computational step , the AD engine might cache some data for backpropagation . ( Griewank & Walther , 2008 ) Frequent caching of data slows down the program significantly , while the memory usage will become a bottleneck as well . Caching implicitly also make these frameworks incompatible with kernel functions . To avoid such issues , we need a new GP-AD framework that does not cache automatically for users . In this paper , we propose to implement the reverse mode AD on a reversible ( domain-specific ) programming language ( Perumalla , 2013 ; Frank , 2017 ) , where intermediate states can be traced backward without accessing an implicit stack . Reversible programming allows people to utilize the reversibility to reverse a program . In machine learning , reversibility is proven to substantially decrease the memory usage in unitary recurrent neural networks ( MacKay et al. , 2018 ) , normalizing flow ( Dinh et al. , 2014 ) , hyper-parameter learning ( Maclaurin et al. , 2015 ) and residual neural networks ( Gomez et al. , 2017 ; Behrmann et al. , 2018 ) . Reversible programming will make these happen naturally . The power of reversible programming is not limited to handling these reversible applications , any program can be written in a reversible style . Converting an irreversible program to the reversible form would cost overheads in time and space . Reversible programming provides a flexible time-space trade-off scheme that different with checkpointing ( Griewank , 1992 ; Griewank & Walther , 2008 ; Chen et al. , 2016 ) , reverse computing ( Bennett , 1989 ; Levine & Sherman , 1990 ) , to let user handle these overheads explicitly . There have been many prototypes of reversible languages like Janus ( Lutz , 1986 ) , R ( not the popular one ) ( Frank , 1997 ) , Erlang ( Lanese et al. , 2018 ) and object-oriented ROOPL ( Haulund , 2017 ) . In the past , the primary motivation to study reversible programming is to support reversible computing devices ( Frank & Knight Jr , 1999 ) such as adiabatic complementary metal-oxide-semiconductor ( CMOS ) ( Koller & Athas , 1992 ) , molecular mechanical computing system ( Merkle et al. , 2018 ) and superconducting system ( Likharev , 1977 ; Semenov et al. , 2003 ; Takeuchi et al. , 2014 ; 2017 ) , and these reversible computing devices are orders more energy-efficient . Landauer proves that only when a device does not erase information ( i.e . reversible ) , its energy efficiency can go beyond the thermal dynamic limit . ( Landauer , 1961 ; Reeb & Wolf , 2014 ) However , these reversible programming languages can not be used directly in real scientific computing , since most of them do not have basic elements like floating point numbers , arrays , and complex numbers . This motivates us to build a new embedded domain-specific language ( eDSL ) in Julia ( Bezanson et al. , 2012 ; 2017 ) as a new playground of GP-AD . In this paper , we first compare the time-space trade-off in the optimal checkpointing and the optimal reverse computing in Sec . 2 . Then we introduce the language design of NiLang in Sec . 3 . In Sec . 4 , we explain the implementation of automatic differentiation in NiLang . In Sec . 5 , we benchmark the performance of NiLang ’ s AD with other AD software and explain why it is fast . 2 Reverse computing as an Alternative to Checkpointing One can use either checkpointing or reverse computing to trace back intermediate states of a T - step computational process s1 = f1 ( s0 ) , s2 = f2 ( s1 ) , . . . , sT = fT ( sT−1 ) with a run-time memory S . In the checkpointing scheme , the program first takes snapshots of states at certain time steps S = { sa , sb , . . . } , 1 ≤ a < b < ... ≤ T by running a forward pass . When retrieving a state sk , if sk ∈ S , just return this state , otherwise , return max j s j < k ∈ S and re-compute sk from s j . In the reverse computing scheme , one first writes the program in a reversible style . Without prior knowledge , a regular program can be transpiled to the reversible style is by doing the transformation in Listing . 1 . Listing 1 : Transpiling a regular code to the reversible code without prior knowledge . s1 += f1 ( s0 ) s2 += f2 ( s1 ) . . . sT += fT ( sT−1 ) Listing 2 : The reverse of Listing . 1 sT −= fT ( sT−1 ) . . . s2 −= f2 ( s1 ) s1 −= f1 ( s0 ) Then one can visit states in the reversed order by running the reversed program in Listing . 2 , which erases the computed results from the tail . One may argue that easing through uncomputing is not necessary here . This is not true for a general reversible program , because the intermediate states might be mutable and used in other parts of the program . It is easy to see , both checkpointing and reverse computing can trace back states without time overhead , but both suffer from a space overhead that linear to time ( Table 1 ) . The checkpointing scheme snapshots the output in every step , and the reverse computing scheme allocates extra storage for storing outputs in every step . On the other side , only checkpointing can achieve a zero space overhead by recomputing everything from the beginning s0 , with a time complexity O ( T 2 ) . The minimum space complexity in reverse computing is O ( S log ( T/S ) ) ( Bennett , 1989 ; Levine & Sherman , 1990 ; Perumalla , 2013 ) , with time complexity O ( T 1.585 ) . The difference in space overheads can be explained by the difference of the optimal checkpointing and optimal reverse computing algorithms . The optimal checkpointing algorithm that widely used in AD is the treeverse algorithm in Fig . 1 ( a ) . This algorithm partitions the computational process binomially into d sectors . At the beginning of each sector , the program snapshots the state and push it into a global stack , hence the memory for checkpointing is dS . The states in the last sector are retrieved by the above space-efficient O ( T 2 ) algorithm . After that , the last snapshot can be freed and the program has one more quota in memory . With the freed memory , the second last sector can be further partition into two sectors . Likewise , the lth sectors is partitioned into l sub-sectors , where l is the sector index counting from the tail . Recursively apply this treeverse algorithm t times until the sector size is 1 . The approximated overhead in time and space are Tc = tT , S c = dS , ( 1 ) where T = η ( t , d ) holds . By carefully choosing either a t or d , the overhead in time and space can be both logarithmic . On the other side , the optimal time-space trade-off scheme in reverse computing is the Bennett ’ s algorithm illustrated in Fig . 1 ( b ) . It evenly evenly partition the program into k sectors . The program marches forward ( P process ) for k steps to obtain the final state sk+1 , then backward ( Q process ) from the k − 1th step to erase the states in between s1 < i < k . This process is also called the compute-copyuncompute process . Recursively apply the compute-copy-uncompute process for each sector until each P/Q process contains only one unit computation . the time and space complexities are Tr = T ( T S ) ln ( 2− ( 1/k ) ) ln k , S r = k − 1 ln k S log T S . ( 2 ) Here , the overhead in time is polynomial , which is worse than the treeverse algorithm . The treeverse like partition does not apply here because the first sweep to create initial checkpoints without introducing any space overheads is not possible in reversible computing . The pseudo-code of Bennett ’ s time-space trade-off algorithm is shown in Listing . 3 . Listing 3 : The Bennett ’ s time-space trade-off scheme . The first argument { s1 , ... } is the collection of states , k is the number of partitions , i and len are the starting point and length of the working sector . A function call changes variables inplace . “ ∼ ” is the symbol of uncomputing , which means undoing a function call . Statement si+1 ← 0 allocates a zero state and add it to the state collection . Its inverse si+1 → 0 discards a zero cleared state from the collection . Its NiLang implementation is in Appendix A. bennett ( { s1 , ... } , k , i , len ) if len == 1 si+1 ← 0 fi ( si+1 , si ) else # P process that calls the forward program k steps bennett ( { s1 , ... } , k , i+len÷k * ( j-1 ) , len÷k ) for j=1,2 , ... , k # Q process that calls the backward program k-1 steps ~bennett ( { s1 , ... } , k , i+len÷k * ( j-1 ) , len÷k ) for j=k-1 , k-2 , ... ,1 The reverse computing does not show advantage from the above complexity analysis . But we argue the this analysis is from the worst case , which are very different to the practical using cases . First , τ ! δ ! is the binomial function . ( b ) Bennett ’ s time space trade-off scheme for reverse computing . ( Bennett , 1973 ; Levine & Sherman , 1990 ) P and Q are computing and uncomputing respectively . The pseudo-code is defined in Listing . 3. reverse computing can make use of the reversibility to save memory . In Appendix B.2 , we show how to implement a unitary matrix multiplication without introducing overheads in space and time . Second , reverse computing does not allocate automatically for users , user can optimize the memory access patterns for their own devices like GPU . Third , reverse computing is compatible with effective codes , so that it fits better with modern languages . In Appendix B.1 , we show how to manipulate inplace functions on arrays with NiLang . Fourth , reverse computing can utilize the existing compiler to optimize the code because it does not introduce global stack operations that harm the purity of functions . Fifth , reverse computing encourages users to think reversibly . In Appendix B.3 , we show reversible thinking can lead the user to a constant memory , constant time implementation of chained multiplication algorithms . 3 Language design NiLang is an embedded domain-specific language ( eDSL ) NiLang built on top of the host language Julia ( Bezanson et al. , 2012 ; 2017 ) . Julia is a popular language for scientific programming and machine learning . We choose Julia mainly for speed . Julia is a language with high abstraction , however , its clever design of type inference and just in time compiling make it has a C like speed . Meanwhile , it has rich features for meta-programming . Its package for pattern matching MLStyle allows us to define an eDSL in less than 2000 lines . Comparing with a regular reversible programming language , NiLang features array operations , rich number systems including floating-point numbers , complex numbers , fixed-point numbers , and logarithmic numbers . It also implements the compute-copy-uncompute ( Bennett , 1973 ) macro to increase code reusability . Besides the above reversible hardware compatible features , it also has some reversible hardware incompatible features to meet the practical needs . For example , it views the floating-point + and − operations as reversible . It also allows users to extend instruction sets and sometimes inserting external statements . These features are not compatible with future reversible hardware . NiLang ’ s compiling process , grammar and operational semantics are described in Appendix G. The source code is also available online , we will put a link here after the anonymous open review session . By the time of writing , the version of NiLang is v0.7.3 . 3.1 Reversible functions and instructions Mathematically , any irreversible mapping y = f ( args ... ) can be trivially transformed to its reversible form y += f ( args ... ) or y Y= f ( args ... ) ( Y is the bit-wise XOR ) , where y is a pre-emptied variable . But in numeric computing with finite precision , this is not always true . The reversibility of arithmetic instruction is closely related to the number system . For integer and fixed point number system , y += f ( args ... ) and y -= f ( args ... ) are rigorously reversible . For logarithmic number system and tropical number system ( Speyer & Sturmfels , 2009 ) , y * = f ( args ... ) and y /= f ( args ... ) as reversible ( not introducing the zero element ) . While for floating point numbers , none of the above operations are rigorously reversible . However , for convenience , we ignore the round-off errors in floating-point + and - operations and treat them on equal footing with fixed-point numbers in the following discussion . In Appendix F , we will show doing this is safe in most cases provided careful implementation . Other reversible operations includes SWAP , ROT , NEG et . al. , and this instruction set is extensible . One can define a reversible multiplier in NiLang as in Listing . 4 . Listing 4 : A reversible multiplier julia > using NiLang julia > @ i function multiplier ( y ! : :Real , a : :Real , b : :Real ) y ! += a * b end julia > multiplier ( 2 , 3 , 5 ) ( 17 , 3 , 5 ) julia > ( ~multiplier ) ( 17 , 3 , 5 ) ( 2 , 3 , 5 ) Macro @ i generates two functions that are reversible to each other , multiplier and ∼multiplier , each defines a mapping R3 → R3 . The ! after a symbol is a part of the name , as a conversion to indicate the mutated variables . 3.2 Reversible memory management A distinct feature of reversible memory management is that the content of a variable must be known when it is deallocated . We denote the allocation of a pre-emptied memory as x ← 0 , and its inverse , deallocating a zero emptied variable , as x → 0 . An unknown variable can not be deallocate , but can be pushed to a stack pop out later in the uncomputing stage . If a variable is allocated and deallocated in the local scope , we call it an ancilla . Listing . 5 defines the complex valued accumulative log function . Listing 5 : Reversible complex valued log function y += log ( |x| ) + iArg ( x ) . @ i @ inline function ( : += ) ( log ) ( y ! : :Complex { T } , x : :Complex { T } ) where T n ← zero ( T ) n += abs ( x ) y ! .re += log ( n ) y ! .im += angle ( x ) n -= abs ( x ) n → zero ( T ) end Listing 6 : Compute-copy-uncompute version of Listing . 5 @ i @ inline function ( : += ) ( log ) ( y ! : :Complex { T } , x : :Complex { T } ) where T @ routine begin n ← zero ( T ) n += abs ( x ) end y ! .re += log ( n ) y ! .im += angle ( x ) ~ @ routine end Here , the macro @ inline tells the compiler that this function can be inlined . One can input “ ← ” and “ → ” by typing “ \leftarrow [ TAB KEY ] ” and “ \rightarrow [ TAB KEY ] ” respectively in a Julia editor or REPL . NiLang does not have immutable structs , so that the real part y ! .re and imaginary y ! .im of a complex number can be changed directly . It is easy to verify that the bottom two lines in the function body are the inverse of the top two lines . i.e. , the bottom two lines uncomputes the top two lines . The motivation of uncomputing is to zero clear the contents in ancilla n so that it can be deallocated correctly . Compute-copy-uncompute is a useful design pattern in reversible programming so that we created a pair of macros @ routine and ∼ @ routine for it . One can rewrite the above function as in Listing . 6 . 3.3 Reversible control flows One can define reversible if , for and while statements in a reversible program . Fig . 2 ( a ) shows the flow chart of executing the reversible if statement . There are two condition expressions in this chart , a precondition and a postcondition . The precondition decides which branch to enter in the forward execution , while the postcondition decides which branch to enter in the backward execution . The pseudo-code for the forward and backward passes are shown in Listing . 7 and Listing . 8 . Listing 7 : Translating a reversible if statement ( forward ) branchkeeper = precondition if precondition branch A else branch B end assert branchkeeper == postcondition Listing 8 : Translating a reversible if statement ( backward ) branchkeeper = postcondition if postcondition ~ ( branch A ) else ~ ( branch B ) end assert branchkeeper == precondition Fig . 2 ( b ) shows the flow chart of the reversible while statement . It also has two condition expressions . Before executing the condition expressions , the program presumes the postcondition is false . After each iteration , the program asserts the postcondition to be true . To reverse this statement , one can exchange the precondition and postcondition , and reverse the body statements . The pseudo-code for the forward and backward passes are shown in Listing . 9 and Listing . 10 . Listing 9 : Translating a reversible while statement ( forward ) assert postcondition == false while precondition loop body assert postcondition == true end Listing 10 : Translating a reversible while statement ( backward ) assert precondition == false while postcondition ~ ( loop body ) assert precondition == true end The reversible for statement is similar to the irreversible one except that after execution , the program will assert the iterator to be unchanged . To reverse this statement , one can exchange start and stop and inverse the sign of step . Listing . 11 computes the Fibonacci number recursively and reversibly . Listing 11 : Computing Fibonacci number recursively and reversibly . @ i function rrfib ( out ! , n ) @ invcheckoff if ( n > = 1 , ~ ) counter ← 0 counter += n while ( counter > 1 , counter ! =n ) rrfib ( out ! , counter-1 ) counter -= 2 end counter -= n % 2 counter → 0 end out ! += 1 end Here , out ! is an integer initialized to 0 for storing outputs . The precondition and postcondition are wrapped into a tuple . In the if statement , the postcondition is the same as the precondition , hence we omit the postcondition by inserting a `` ∼ '' in the second field for “ copying the precondition in this field as the postcondition ” . In the while statement , the postcondition is true only for the initial loop . Once code is proven correct , one can turn off the reversibility check by adding @ invcheckoff before a statement . This will remove the reversibility check and make the code faster and compatible with GPU kernels ( kernel functions can not handle exceptions ) . 4 Reversible automatic differentiation 4.1 Back propagation original program O reverse program R gradient program for R comp ute reverse reverse gradient program for O We decompose the problem of reverse mode AD into two sub-problems , reversing the code and computing ∂ [ single input ] ∂ [ multiple outputs ] . Reversing the code is trivial in reversible programming . Computing the gradient here is similar to forward mode automatic differentiation that computes ∂ [ multiple outputs ] ∂ [ single input ] . Inspired by the Julia package ForwardDiff ( Revels et al. , 2016 ) , we use the operator overloading technique to differentiate the program efficiently . In the backward pass , we wrap each output variable with a composite type GVar that containing an extra gradient field , and feed it into the reversed generic program . Instructions are multiple dispatched to corresponding gradient instructions that update the gradient field of GVar at the meantime of uncomputing . By reversing this gradient program , we can obtain the gradient program for the reversed program too . One can define the adjoint ( “ adjoint ” here means the program for back-propagating gradients ) of a primitive instruction as a reversible function on either the function itself or its reverse since the adjoint of a function ’ s reverse is equivalent to the reverse of the function ’ s adjoint . f : ( ~x , ~gx ) → ( ~y , ~gTx ∂~x ∂~y ) ( 3 ) f −1 : ( ~y , ~gy ) → ( ~x , ~gTy ∂~y ∂~x ) ( 4 ) It can be easily verified by applying the above two mappings consecutively , which turns out to be an identity mapping considering ∂~y ∂~x ∂~x ∂~y = 1 . The implementation details are described in Appendix C. In most languages , operator overloading is accompanied with significant overheads of function calls and object allocation and deallocation . But in a language with type inference and just in time compiling like Julia , the boundary between two approaches are vague . The compiler inlines small functions , packs an array of constant sized immutable objects into a continuous memory , and truncates unnecessary branches automatically . 4.2 Hessians Combining forward mode AD and reverse mode AD is a simple yet efficient way to obtain Hessians . By wrapping the elementary type with Dual defined in package ForwardDiff and throwing it into the gradient program defined in NiLang , one obtains one row/column of the Hessian matrix . We will use this approach to compute Hessians in the graph embedding benchmark in Sec . D.2 . 4.3 CUDA kernels CUDA programming is playing a significant role in high-performance computing . In Julia , one can write GPU compatible functions in native Julia language with KernelAbstractions . ( Besard et al. , 2017 ) Since NiLang does not push variables into stack automatically for users , it is safe to write differentiable GPU kernels with NiLang . We will differentiate CUDA kernels with no more than extra 10 lines in the bundle adjustment benchmark in Sec . 5 . 5 Benchmarks We benchmark our framework with the state-of-the-art GP-AD frameworks , including source code transformation based Tapenade and Zygote and operator overloading based ForwardDiff and ReverseDiff . Since most tensor based AD software like famous TensorFlow and PyTorch are not designed for the using cases used in our benchmarks , we do not include those package to avoid an unfair comparison . In the following benchmarks , the CPU device is Intel ( R ) Xeon ( R ) Gold 6230 CPU @ 2.10GHz , and the GPU device is NVIDIA Titan V. For NiLang benchmarks , we have turned the reversibility check off to achieve a better performance . We reproduced the benchmarks for Gaussian mixture model ( GMM ) and bundle adjustment in Srajer et al . ( 2018 ) by re-writing the programs in a reversible style . We show the results in Fig . 3 . The Tapenade data is obtained by executing the docker file provided by the original benchmark , which provides a baseline for comparison . NiLang ’ s objective function is ∼2× slower than normal code due to the uncomputing overhead . In this case , NiLang does not show advantage to Tapenade in obtaining gradients , the ratio between computing the gradients and the objective function are close . This is because the bottleneck of this model is the matrix vector multiplication , traditional AD can already handle this function well . The extra memory used to reverse the program is negligible comparing to the original program as shown in Fig . 4 . The backward pass is not shown here , it is just two times the reversible program in order to store gradients . The data is obtained by counting the main memory allocations in the program manually . The analytical expression of memory usage in unit of floating point number is S = ( 2 + d2 ) k + 2d + P , ( 5 ) S r = ( 3 + d2 + d ) k + 2log2k + P , ( 6 ) where d and k are the size and number of covariance matrices . P = d ( d+1 ) 2 k + k + dk is the size of parameter space . The memory of the dataset ( d×N ) is not included because it will scale as N. Due to the hardness of estimating peak memory usage , the Tapenade data is missing here . The ForwardDiff memory usage is approximately the original size times the batch size , where the batch size is 12 by default . In the bundle adjustment benchmark , NiLang performs the best on CPU . We also compiled our adjoint program to GPU with no more than 10 lines of code with KernelAbstractions , which provides another ∼200× speed up . Parallelizing the adjoint code requires the forward code not reading the same variable simultaneously in different threads , and this requirement is satisfied here . The peak memory of the original program and the reversible program are both equal to the size of parameter space because all “ allocation ” s happen on registers in this application . One can find more benchmarks in Appendix D , including differentiating sparse matrix dot product and obtaining Hessians in the graph embedding application . 6 Discussion In this work , we demonstrate a new approach to back propagates a program called reverse computing AD by designing a reversible eDSL NiLang . NiLang is a powerful tool to differentiate code from the source code level so that can be directly useful to machine learning researches . It can generate efficient backward rules , which is exemplified in Appendix E. It can also be used to differentiate reversible neural networks like normalizing flows ( Kobyzev et al. , 2019 ) to save memory , e.g . backpropagating NICE network ( Dinh et al. , 2014 ) with only constant space overheads . NiLang is most useful in solving large scale scientific problems memory efficiently . In Liu et al . ( 2020 ) , people solve the ground state problem of a 28 × 28 square lattice spin-glass by re-writing the quantum simulator with NiLang . There are some challenges in reverse computing AD too . • The native BLAS and convolution operations in NiLang are not optimized for the memory layout , and are too slow comparing with state of the art machine learning libraries . We need a better implementation of these functions in the reversible programming context so that it can be more useful in training traditional deep neural networks . • Although we show some examples of training neural networks on GPU , the shared-reading of a variable is not allowed . • NiLang ’ s IR does not have variable analysis . The uncomputing pass is not always necessary for the irreversible host language to deallocate memory . In many cases , the host language ’ s variable analysis can figure this out , but it is not guarantted . Another interesting issue is how to make use of reversible computing devices to save energy in machine learning . Reversible computing is not always more energy efficient than irreversible computing . In the time-space trade-off scheme in Sec . 2 , we show the time to uncompute a unit of memory is exponential to n as Qn = ( 2k − 1 ) n , and the computing energy also increases exponentially . On the other side , the amount of energy to erase a unit of memory is a constant . When ( 2k − 1 ) n > 1/ξ , erasing the memory irreversibly is more energy-efficient , where ξ is the energy ratio between a reversible operation ( an instruction or a gate ) and its irreversible counterpart . Acknowledgments The authors are grateful to the people who help improve this work and fundings that sponsored the research . To meet the anonymous criteria , we will add the acknowledgments after the open review session . References Martín Abadi , Ashish Agarwal , Paul Barham , Eugene Brevdo , Zhifeng Chen , Craig Citro , Greg S. Corrado , Andy Davis , Jeffrey Dean , Matthieu Devin , Sanjay Ghemawat , Ian Goodfellow , Andrew Harp , Geoffrey Irving , Michael Isard , Yangqing Jia , Rafal Jozefowicz , Lukasz Kaiser , Manjunath Kudlur , Josh Levenberg , Dandelion Mané , Rajat Monga , Sherry Moore , Derek Murray , Chris Olah , Mike Schuster , Jonathon Shlens , Benoit Steiner , Ilya Sutskever , Kunal Talwar , Paul Tucker , Vincent Vanhoucke , Vijay Vasudevan , Fernanda Viégas , Oriol Vinyals , Pete Warden , Martin Wattenberg , Martin Wicke , Yuan Yu , and Xiaoqiang Zheng . TensorFlow : Large-scale machine learning on heterogeneous systems , 2015 . URL https : //www.tensorflow.org/ . Software available from tensorflow.org . Jens Behrmann , David Duvenaud , and Jörn-Henrik Jacobsen . Invertible residual networks . CoRR , abs/1811.00995 , 2018 . URL http : //arxiv.org/abs/1811.00995 . Charles H. Bennett . Logical reversibility of computation . 1973 . URL https : //ieeexplore . ieee.org/abstract/document/5391327 . Charles H. Bennett . Time/space trade-offs for reversible computation . SIAM Journal on Computing , 18 ( 4 ) :766–776 , 1989. doi : 10.1137/0218053 . URL https : //doi.org/10.1137/0218053 . Ville Bergholm , Josh Izaac , Maria Schuld , Christian Gogolin , M. Sohaib Alam , Shahnawaz Ahmed , Juan Miguel Arrazola , Carsten Blank , Alain Delgado , Soran Jahangiri , Keri McKiernan , Johannes Jakob Meyer , Zeyue Niu , Antal Száva , and Nathan Killoran . Pennylane : Automatic differentiation of hybrid quantum-classical computations , 2018 . URL https : //arxiv.org/ abs/1811.04968 . Tim Besard , Christophe Foket , and Bjorn De Sutter . Effective extensible programming : Unleashing julia on gpus . CoRR , abs/1712.03112 , 2017 . URL http : //arxiv.org/abs/1712.03112 . Jeff Bezanson , Stefan Karpinski , Viral B. Shah , and Alan Edelman . Julia : A fast dynamic language for technical computing , 2012 . URL https : //arxiv.org/abs/1209.5145 . Jeff Bezanson , Alan Edelman , Stefan Karpinski , and Viral B. Shah . Julia : A fresh approach to numerical computing . SIAM Review , 59 ( 1 ) :65–98 , Jan 2017 . ISSN 1095-7200. doi : 10.1137/ 141000671 . URL http : //dx.doi.org/10.1137/141000671 . Tianqi Chen , Bing Xu , Chiyuan Zhang , and Carlos Guestrin . Training deep nets with sublinear memory cost . CoRR , abs/1604.06174 , 2016 . URL http : //arxiv.org/abs/1604.06174 . Laurent Dinh , David Krueger , and Yoshua Bengio . Nice : Non-linear independent components estimation , 2014 . URL https : //arxiv.org/abs/1410.8516 . GAEL Forget , J-M Campin , Patrick Heimbach , Christopher N Hill , Rui M Ponte , and Carl Wunsch . Ecco version 4 : An integrated framework for non-linear inverse modeling and global ocean state estimation . 2015 . URL https : //dspace.mit.edu/handle/1721.1/99660 . Michael P Frank . The r programming language and compiler . Technical report , MIT Reversible Computing Project Memo , 1997 . Michael P. Frank . Throwing computing into reverse . IEEE Spectrum , 54 ( 9 ) :32–37 , Sep 2017 . ISSN 0018-9235. doi : 10.1109/mspec.2017.8012237 . URL http : //dx.doi.org/10.1109/MSPEC . 2017.8012237 . Michael Patrick Frank and Thomas F Knight Jr. Reversibility for efficient computing . PhD thesis , 1999 . URL http : //citeseerx.ist.psu.edu/viewdoc/download ? doi=10.1.1 . 428.4962 & rep=rep1 & type=pdf . Gene H Golub and Charles F Van Loan . Matrix computations , volume 3 . JHU press , 2012 . Aidan N Gomez , Mengye Ren , Raquel Urtasun , and Roger B Grosse . The reversible residual network : Backpropagation without storing activations . 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 . 2214–2224 . Curran Associates , Inc. , 2017 . URL http : //papers.nips.cc/paper/ 6816-the-reversible-residual-network-backpropagation-without-storing-activations . pdf . Andreas Griewank . Achieving logarithmic growth of temporal and spatial complexity in reverse automatic differentiation . Optimization Methods and software , 1 ( 1 ) :35–54 , 1992 . URL https : //www.tandfonline.com/doi/abs/10.1080/10556789208805505 . Andreas Griewank and Andrea Walther . Evaluating derivatives : principles and techniques of algorithmic differentiation . SIAM , 2008 . Jin-Guo Liu Hao Xie and Lei Wang . Automatic differentiation of dominant eigensolver and its applications in quantum physics . URL https : //arxiv.org/abs/2001.04121 . Laurent Hascoet and Valérie Pascual . The tapenade automatic differentiation tool : Principles , model , and specification . ACM Transactions on Mathematical Software ( TOMS ) , 39 ( 3 ) :20 , 2013 . URL https : //dl.acm.org/citation.cfm ? id=2450158 . Tue Haulund . Design and implementation of a reversible object-oriented programming language , 2017 . URL https : //arxiv.org/abs/1707.07845 . Claudius Hubig . Use and implementation of autodifferentiation in tensor network methods with complex scalars , 2019 . URL https : //arxiv.org/abs/1907.13422 . Michael Innes . Don ’ t unroll adjoint : Differentiating ssa-form programs , 2018 . URL https : // arxiv.org/abs/1810.07951 . Michael Innes , Elliot Saba , Keno Fischer , Dhairya Gandhi , Marco Concetto Rudilosso , Neethu Mariya Joy , Tejan Karmali , Avik Pal , and Viral Shah . Fashionable modelling with flux , 2018 . URL https : //arxiv.org/abs/1811.01457 . Mike Innes , Alan Edelman , Keno Fischer , Christopher Rackauckas , Elliot Saba , Viral B. Shah , and Will Tebbutt . A differentiable programming system to bridge machine learning and scientific computing . CoRR , abs/1907.07587 , 2019 . URL http : //arxiv.org/abs/1907.07587 . Li Jing , Yichen Shen , Tena Dubcek , John Peurifoy , Scott Skirlo , Yann LeCun , Max Tegmark , and Marin Soljacić . Tunable efficient unitary neural networks ( eunn ) and their application to rnns , 2016 . URL https : //arxiv.org/abs/1612.05231 . Diederik P Kingma and Jimmy Ba . Adam : A method for stochastic optimization . URL https : //arxiv.org/abs/1412.6980 . Ivan Kobyzev , Simon Prince , and Marcus A. Brubaker . Normalizing flows : An introduction and review of current methods , 2019 . J. G. Koller and W. C. Athas . Adiabatic switching , low energy computing , and the physics of storing and erasing information . In Workshop on Physics and Computation , pp . 267–270 , Oct 1992. doi : 10.1109/PHYCMP.1992.615554 . URL https : //ieeexplore.ieee.org/document/615554 . Rolf Landauer . Irreversibility and heat generation in the computing process . IBM journal of research and development , 5 ( 3 ) :183–191 , 1961 . URL https : //ieeexplore.ieee.org/document/ 5392446 . Ivan Lanese , Naoki Nishida , Adrián Palacios , and Germán Vidal . A theory of reversibility for erlang . Journal of Logical and Algebraic Methods in Programming , 100:71–97 , Nov 2018 . ISSN 2352-2208. doi : 10.1016/j.jlamp.2018.06.004 . URL http : //dx.doi.org/10.1016/ j.jlamp.2018.06.004 . Robert Y Levine and Alan T Sherman . A note on bennett ’ s time-space tradeoff for reversible computation . SIAM Journal on Computing , 19 ( 4 ) :673–677 , 1990 . URL https : //epubs.siam . org/doi/abs/10.1137/0219046 . Hai-Jun Liao , Jin-Guo Liu , Lei Wang , and Tao Xiang . Differentiable programming tensor networks . Physical Review X , 9 ( 3 ) , Sep 2019 . ISSN 2160-3308. doi : 10.1103/physrevx.9.031041 . URL http : //dx.doi.org/10.1103/PhysRevX.9.031041 . K. Likharev . Dynamics of some single flux quantum devices : I. parametric quantron . IEEE Transactions on Magnetics , 13 ( 1 ) :242–244 , January 1977 . ISSN 1941-0069. doi : 10.1109/ TMAG.1977.1059351 . URL https : //ieeexplore.ieee.org/document/1059351 . Jin-Guo Liu , Lei Wang , and Pan Zhang . Tropical tensor network for ground states of spin glasses , 2020 . URL https : //arxiv.org/abs/2008.06888 . Xiu-Zhe Luo , Jin-Guo Liu , Pan Zhang , and Lei Wang . Yao.jl : Extensible , efficient framework for quantum algorithm design , 2019 . URL https : //arxiv.org/abs/1912.10877 . Christopher Lutz . Janus : a time-reversible language . Letter to R . Landauer. , 1986 . Matthew MacKay , Paul Vicol , Jimmy Ba , and Roger B Grosse . Reversible recurrent neural networks . In S. Bengio , H. Wallach , H. Larochelle , K. Grauman , N. CesaBianchi , and R. Garnett ( eds . ) , Advances in Neural Information Processing Systems 31 , pp . 9029–9040 . Curran Associates , Inc. , 2018 . URL http : //papers.nips.cc/paper/ 8117-reversible-recurrent-neural-networks.pdf . Dougal Maclaurin , David Duvenaud , and Ryan Adams . Gradient-based hyperparameter optimization through reversible learning . In Francis Bach and David Blei ( eds . ) , Proceedings of the 32nd International Conference on Machine Learning , volume 37 of Proceedings of Machine Learning Research , pp . 2113–2122 , Lille , France , 07–09 Jul 2015 . PMLR . URL http : //proceedings.mlr.press/v37/maclaurin15.html . Ralph C. Merkle , Robert A. Freitas , Tad Hogg , Thomas E. Moore , Matthew S. Moses , and James Ryley . Mechanical computing systems using only links and rotary joints . Journal of Mechanisms and Robotics , 10 ( 6 ) , Sep 2018 . ISSN 1942-4310. doi : 10.1115/1.4041209 . URL http : //dx . doi.org/10.1115/1.4041209 . 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 . In NIPS Autodiff Workshop , 2017 . URL https : //openreview.net/forum ? id= BJJsrmfCZ . Kalyan S Perumalla . Introduction to reversible computing . Chapman and Hall/CRC , 2013 . David Reeb and Michael M Wolf . An improved landauer principle with finite-size corrections . New Journal of Physics , 16 ( 10 ) :103011 , 2014 . URL https : //iopscience.iop.org/article/ 10.1088/1367-2630/16/10/103011/meta . Jarrett Revels , Miles Lubin , and Theodore Papamarkou . Forward-mode automatic differentiation in julia , 2016 . URL https : //arxiv.org/abs/1607.07892 . Chase Roberts , Ashley Milsted , Martin Ganahl , Adam Zalcman , Bruce Fontaine , Yijian Zou , Jack Hidary , Guifre Vidal , and Stefan Leichenauer . Tensornetwork : A library for physics and machine learning , 2019 . URL https : //arxiv.org/abs/1905.01330 . Matthias Seeger , Asmus Hetzel , Zhenwen Dai , Eric Meissner , and Neil D. Lawrence . Autodifferentiating linear algebra , 2017 . URL https : //arxiv.org/abs/1710.08717 . V. K. Semenov , G. V. Danilov , and D. V. Averin . Negative-inductance squid as the basic element of reversible josephson-junction circuits . IEEE Transactions on Applied Superconductivity , 13 ( 2 ) :938–943 , June 2003 . ISSN 2378-7074. doi : 10.1109/TASC.2003.814155 . URL https : //ieeexplore.ieee.org/document/1211760 . Yan Shen and Yuxing Dai . Fast automatic differentiation for large scale bundle adjustment . IEEE Access , 6:11146–11153 , 2018 . URL https : //ieeexplore.ieee.org/abstract/document/ 8307241/ . David Speyer and Bernd Sturmfels . Tropical mathematics . Mathematics Magazine , 82 ( 3 ) :163– 173 , 2009 . URL https : //www.tandfonline.com/doi/pdf/10.1080/0025570X.2009 . 11953615 . Filip Srajer , Zuzana Kukelova , and Andrew Fitzgibbon . A benchmark of selected algorithmic differentiation tools on some problems in computer vision and machine learning . Optimization Methods and Software , 33 ( 4-6 ) :889–906 , 2018 . URL https : //openreview.net/forum ? id= SMCWZLzTGDN . Jun Takahashi and Anders W. Sandvik . Valence-bond solids , vestigial order , and emergent so ( 5 ) symmetry in a two-dimensional quantum magnet , 2020 . URL https : //arxiv.org/abs/2001 . 10045 . N Takeuchi , Y Yamanashi , and N Yoshikawa . Reversible logic gate using adiabatic superconducting devices . Scientific reports , 4:6354 , 2014 . URL https : //www.nature.com/articles/ srep06354 . Naoki Takeuchi , Yuki Yamanashi , and Nobuyuki Yoshikawa . Reversibility and energy dissipation in adiabatic superconductor logic . Scientific reports , 7 ( 1 ) :1–12 , 2017 . URL https : //www . nature.com/articles/s41598-017-00089-9 . Clay S Turner . A fast binary logarithm algorithm [ dsp tips & tricks ] . IEEE Signal Processing Magazine , 27 ( 5 ) :124–140 , 2010 . URL http : //www.claysturner.com/dsp/binarylogarithm . pdf . Jean Utke , Uwe Naumann , Mike Fagan , Nathan Tallent , Michelle Strout , Patrick Heimbach , Chris Hill , and Carl Wunsch . Openad/f : A modular open-source tool for automatic differentiation of fortran codes . ACM Trans . Math . Softw. , 34 ( 4 ) , July 2008 . ISSN 0098-3500. doi : 10.1145/ 1377596.1377598 . URL https : //doi.org/10.1145/1377596.1377598 . Zhou-Quan Wan and Shi-Xin Zhang . Automatic differentiation for complex valued svd , 2019 . URL https : //arxiv.org/abs/1909.02659 . Weiqiang Zhu , Kailai Xu , Eric Darve , and Gregory C. Beroza . A general approach to seismic inversion with automatic differentiation , 2020 . URL https : //arxiv.org/abs/2003.06027 . A NiLang implementation of Bennett ’ s time-space trade-off algorithm Listing 12 : NiLang implementation of the Bennett ’ s time-space trade-off scheme . using NiLang , Test PROG_COUNTER = Ref ( 0 ) # ( 2k-1 ) ^n PEAK_MEM = Ref ( 0 ) # n * ( k-1 ) +2 @ i function bennett ( f : :AbstractVector , state : :Dict { Int , T } , k : :Int , base , len ) where T if ( len == 1 , ~ ) state [ base+1 ] ← zero ( T ) f [ base ] ( state [ base+1 ] , state [ base ] ) @ safe PROG_COUNTER [ ] += 1 @ safe ( length ( state ) > PEAK_MEM [ ] & & ( PEAK_MEM [ ] = length ( state ) ) ) else n ← 0 n += len÷k # the P process for j=1 : k bennett ( f , state , k , base+n * ( j-1 ) , n ) end # the Q process for j=k-1 : -1:1 ~bennett ( f , state , k , base+n * ( j-1 ) , n ) end n -= len÷k n → 0 end end k = 4 n = 4 N = k ^ n state = Dict ( 1= > 1.0 ) f ( x ) = x * 2.0 instructions = fill ( PlusEq ( f ) , N ) # run the program @ instr bennett ( instructions , state , k , 1 , N ) @ test state [ N+1 ] ≈ 2.0^N & & length ( state ) == 2 @ test PEAK_MEM [ ] == n * ( k-1 ) + 2 @ test PROG_COUNTER [ ] == ( 2 * k-1 ) ^n The input f is a vector of functions and state is a dictionary . We also added some irreversible external statements ( those marked with @ safe ) to help analyse to program . B Cases where reverse computing shows advantage B.1 Handling effective codes Reverse computing can handling effective codes with mutable structures and arrays . For example , the affine transformation can be implemented without any overhead . Listing 13 : Inplace affine transformation . @ i function i_affine ! ( y ! : :AbstractVector { T } , W : :AbstractMatrix { T } , b : :AbstractVector { T } , x : : AbstractVector { T } ) where T @ safe @ assert size ( W ) == ( length ( y ! ) , length ( x ) ) & & length ( b ) == length ( y ! ) @ invcheckoff for j=1 : size ( W , 2 ) for i=1 : size ( W , 1 ) @ inbounds y ! [ i ] += W [ i , j ] * x [ j ] end end @ invcheckoff for i=1 : size ( W , 1 ) @ inbounds y ! [ i ] += b [ i ] end end Here , the expression following the @ safe macro is an external irreversible statement . B.2 Utilizing reversibility Reverse computing can utilize reversibility to trace back states without extra memory cost . For example , we can define the unitary matrix multiplication that can be used in a type of memoryefficient recurrent neural network . ( Jing et al. , 2016 ) Listing 14 : Two level decomposition of a unitary matrix . @ i function i_umm ! ( x ! : :AbstractArray , θ ) M ← size ( x ! , 1 ) N ← size ( x ! , 2 ) k ← 0 @ safe @ assert length ( θ ) == M * ( M-1 ) /2 for l = 1 : N for j=1 : M for i=M-1 : -1 : j INC ( k ) ROT ( x ! [ i , l ] , x ! [ i+1 , l ] , θ [ k ] ) end end end k → length ( θ ) end B.3 Encourages reversible thinking Last but not least , reversible programming encourages users to code in a memory friendly style . Since allocations in reversible programming are explicit , programmers have the flexibility to control how to allocate memory and which number system to use . For example , to compute the power of a positive fixed-point number and an integer , one can easily write irreversible code as in Listing . 15 Listing 15 : A regular power function . function mypower ( x : :T , n : :Int ) where T y = one ( T ) for i=1 : n y * = x end return y end Listing 16 : A reversible power function . @ i function mypower ( out , x : :T , n : :Int ) where T if ( x ! = 0 , ~ ) @ routine begin ly ← one ( ULogarithmic { T } ) lx ← one ( ULogarithmic { T } ) lx * = convert ( x ) for i=1 : n ly * = x end end out += convert ( ly ) ~ @ routine end end Since the fixed-point number is not reversible under * = , naive checkpointing would require stack operations inside a loop . With reversible thinking , we can convert the fixed-point number to logarithmic numbers to utilize the reversibility of * = as shown in Listing . 16 . Here , the algorithm to convert a regular fixed-point number to a logarithmic number can be efficient . ( Turner , 2010 ) C Implementation of AD in NiLang To backpropagate the program , we first reverse the code through source code transformation and then insert the gradient code through operator overloading . If we inline all the functions in Listing . 6 , the function body would be like Listing . 17 . The automatically generated inverse program ( i.e . ( y , x ) → ( y − log ( x ) , x ) ) would be like Listing . 18 . Listing 17 : The inlined function body of Listing . 6 . @ routine begin nsq ← zero ( T ) n ← zero ( T ) nsq += x [ i ] .re ^ 2 nsq += x [ i ] .im ^ 2 n += sqrt ( nsq ) end y ! [ i ] .re += log ( n ) y ! [ i ] .im += atan ( x [ i ] .im , x [ i ] .re ) ~ @ routine Listing 18 : The inverse of Listing . 17 . @ routine begin nsq ← zero ( T ) n ← zero ( T ) nsq += x [ i ] .re ^ 2 nsq += x [ i ] .im ^ 2 n += sqrt ( nsq ) end y ! [ i ] .re -= log ( n ) y ! [ i ] .im -= atan ( x [ i ] .im , x [ i ] .re ) ~ @ routine To compute the adjoint of the computational process in Listing . 17 , one simply insert the gradient code into its inverse in Listing . 18 . The resulting inlined code is show in Listing . 19 . Listing 19 : Insert the gradient code into Listing . 18 , the original computational processes are highlighted in yellow background . @ routine begin nsq ← zero ( GVar { T , T } ) n ← zero ( GVar { T , T } ) gsqa ← zero ( T ) gsqa += x [ i ] .re.x * 2 x [ i ] .re.g -= gsqa * nsq.g gsqa -= nsq.x * 2 gsqa -= x [ i ] .re.x * 2 gsqa → zero ( T ) nsq.x += x [ i ] .re.x ^2 gsqb ← zero ( T ) gsqb += x [ i ] .im.x * 2 x [ i ] .im.g -= gsqb * nsq.g gsqb -= x [ i ] .im.x * 2 gsqb → zero ( T ) nsq.x += x [ i ] .im.x ^2 @ zeros T ra rb rta += sqrt ( nsq.x ) rb += 2 * ra nsq.g -= n.g / rb rb -= 2 * ra ra -= sqrt ( nsq.x ) ~ @ zeros T ra rb n.x += sqrt ( nsq.x ) end y ! [ i ] .re.x -= log ( n.x ) n.g += y ! [ i ] .re.g / n.x y ! [ i ] .im.x-=atan ( x [ i ] .im.x , x [ i ] .re.x ) @ zeros T xy2 jac_x jac_y xy2 += abs2 ( x [ i ] .re.x ) xy2 += abs2 ( x [ i ] .im.x ) jac_y += x [ i ] .re.x / xy2 jac_x += ( -x [ i ] .im.x ) / xy2 x [ i ] .im.g += y ! [ i ] .im.g * jac_y x [ i ] .re.g += y ! [ i ] .im.g * jac_x jac_x -= ( -x [ i ] .im.x ) / xy2 jac_y -= x [ i ] .re.x / xy2 xy2 -= abs2 ( x [ i ] .im.x ) xy2 -= abs2 ( x [ i ] .re.x ) ~ @ zeros T xy2 jac_x jac_y ~ @ routine Here , @ zeros TYPE var1 var2 ... is the macro to allocate multiple variables of the same type . Its inverse operations starts with ∼ @ zeros deallocates zero emptied variables . In practice , “ inserting gradients ” is not achieved by source code transformation , but by operator overloading . We change the element type to a composite type GVar with two fields , value x and gradient g. With multiple dispatching primitive instructions on this new type , values and gradients can be updated simultaneously . Although the code looks much longer , the computing time ( with reversibility check closed ) is not . Listing 20 : Time and allocation to differentiate complex valued log . julia > using NiLang , NiLang.AD , BenchmarkTools julia > @ inline function ( ir_log ) ( x : :Complex { T } ) where T log ( abs ( x ) ) + im * angle ( x ) end julia > @ btime ir_log ( x ) setup= ( x=1.0+1.2im ) ; # native code 30.097 ns ( 0 allocations : 0 bytes ) julia > @ btime ( @ instr y += log ( x ) ) setup= ( x=1.0+1.2im ; y=0.0+0.0im ) ; # reversible code 17.542 ns ( 0 allocations : 0 bytes ) julia > @ btime ( @ instr ~ ( y += log ( x ) ) ) setup= ( x=GVar ( 1.0+1.2im , 0.0+0.0im ) ; y=GVar ( 0.1+0.2im , 1.0+0.0im ) ) ; # adjoint code 25.932 ns ( 0 allocations : 0 bytes ) The performance is unreasonably good because the generated Julia code is further compiled to LLVM so that it can enjoy existing optimization passes . For example , the optimization passes can find out that for an irreversible device , uncomputing local variables n and nsq to zeros does not affect return values , so that it will ignore the uncomputing process automatically . Unlike checkpointing based approaches that focus a lot in the optimization of data caching on a global stack , NiLang does not have any optimization pass in itself . Instead , it throws itself to existing optimization passes in Julia . Without accessing the global stack , NiLang ’ s code is quite friendly to optimization passes . In this case , we also see the boundary between source code transformation and operator overloading can be vague in a Julia , in that the generated code can be very different from how it looks . The joint functions for primitive instructions ( : += ) ( sqrt ) and ( : -= ) ( sqrt ) used above can be defined as in Listing . 21 . Listing 21 : Adjoints for primitives ( : += ) ( sqrt ) and ( : -= ) ( sqrt ) . @ i @ inline function ( : -= ) ( sqrt ) ( out ! : :GVar , x : :GVar { T } ) where T @ routine @ invcheckoff begin @ zeros T a b a += sqrt ( x.x ) b += 2 * a end out ! .x -= a x.g += out ! .g / b ~ @ routine end D More Benchmarks D.1 Sparse matrices We compare the call , uncall and backward propagation time used for sparse matrix dot product and matrix multiplication in Table 2 . Their reversible implementations are shown in Listing . 22 and Listing . 23 . The computing time for backward propagation is approximately 1.5-3 times the Julia ’ s native forward pass , which is close to the theoretical optimal performance . Listing 22 : Reversible sparse matrix multiplication . using SparseArrays @ i function i_dot ( r : :T , A : :SparseMatrixCSC { T } , B : :SparseMatrixCSC { T } ) where { T } m ← size ( A , 1 ) n ← size ( A , 2 ) @ invcheckoff branch_keeper ← zeros ( Bool , 2 * m ) @ safe size ( B ) == ( m , n ) || throw ( DimensionMismatch ( `` matrices must have the same dimensions '' ) ) @ invcheckoff @ inbounds for j = 1 : n ia1 ← A.colptr [ j ] ib1 ← B.colptr [ j ] ia2 ← A.colptr [ j+1 ] ib2 ← B.colptr [ j+1 ] ia ← ia1 ib ← ib1 @ inbounds for i=1 : ia2-ia1+ib2-ib1-1 ra ← A.rowval [ ia ] rb ← B.rowval [ ib ] if ( ra == rb , ~ ) r += A.nzval [ ia ] ' * B.nzval [ ib ] end # # b move - > true , a move - > false branch_keeper [ i ] Y= ia == ia2-1 || ( ib ! = ib2-1 & & ra > rb ) ra → A.rowval [ ia ] rb → B.rowval [ ib ] if ( branch_keeper [ i ] , ~ ) INC ( ib ) else INC ( ia ) end end ~ @ inbounds for i=1 : ia2-ia1+ib2-ib1-1 # # b move - > true , a move - > false branch_keeper [ i ] Y= ia == ia2-1 || ( ib ! = ib2-1 & & A.rowval [ ia ] > B.rowval [ ib ] ) if ( branch_keeper [ i ] , ~ ) INC ( ib ) else INC ( ia ) end end end @ invcheckoff branch_keeper → zeros ( Bool , 2 * m ) end Listing 23 : Reversible sparse matrix dot-product . @ i function i_mul ! ( C : :StridedVecOrMat , A : :AbstractSparseMatrix , B : :StridedVector { T } , α : : Number , β : :Number ) where T @ safe size ( A , 2 ) == size ( B , 1 ) || throw ( DimensionMismatch ( ) ) @ safe size ( A , 1 ) == size ( C , 1 ) || throw ( DimensionMismatch ( ) ) @ safe size ( B , 2 ) == size ( C , 2 ) || throw ( DimensionMismatch ( ) ) nzv ← nonzeros ( A ) rv ← rowvals ( A ) if ( β ! = 1 , ~ ) @ safe error ( `` only β = 1 is supported , got β = $ ( β ) . '' ) end # Here , we close the reversibility check inside the loop to increase performance @ invcheckoff for k = 1 : size ( C , 2 ) @ inbounds for col = 1 : size ( A , 2 ) αxj ← zero ( T ) αxj += B [ col , k ] * α for j = SparseArrays.getcolptr ( A ) [ col ] : ( SparseArrays.getcolptr ( A ) [ col + 1 ] - 1 ) C [ rv [ j ] , k ] += nzv [ j ] * αxj end αxj -= B [ col , k ] * α end end end D.2 Graph embedding problem Graph embedding can be used to find a proper representation for an order parameter ( Takahashi & Sandvik , 2020 ) in condensed matter physics . People want to find a minimum Euclidean space dimension k that a Petersen graph can embed into , that the distances between pairs of connected vertices are l1 , and the distance between pairs of disconnected vertices are l2 , where l2 > l1 . The Petersen graph is shown in Fig . 5 . Let us denote the set of connected and disconnected vertex pairs as L1 and L2 , respectively . This problem can be variationally solved with the following loss . L = Var ( dist ( L1 ) ) + Var ( dist ( L2 ) ) + exp ( relu ( dist ( L1 ) − dist ( L2 ) + 0.1 ) ) ) − 1 ( 7 ) The first line is a summation of distance variances in two sets of vertex pairs , where Var ( X ) is the variance of samples in X . The second line is used to guarantee l2 > l1 , where X means taking the average of samples in X . Its reversible implementation could be found in our benchmark repository . We repeat the training for dimension k from 1 to 10 . In each training , we fix two of the vertices and optimize the positions of the rest . Otherwise , the program will find the trivial solution with overlapped vertices . For k < 5 , the loss is always much higher than 0 , while for k ≥ 5 , we can get a loss close to machine precision with high probability . From the k = 5 solution , it is easy to see l2/l1 = √ 2 . An Adam optimizer with a learning rate 0.01 ( Kingma & Ba ) requires ∼2000 steps training . The trust region Newton ’ s method converges much faster , which requires∼20 computations of Hessians to reach convergence . Although training time is comparable , the converged precision of the later is much better . Since one can combine ForwardDiff and NiLang to obtain Hessians , it is interesting to see how much performance we can get in differentiating the graph embedding program . In Table 3 , we show the the performance of different implementations by varying the dimension k. The number of parameters is 10k . As the baseline , ( a ) shows the time for computing the function call . We have reversible and irreversible implementations , where the reversible program is slower than the irreversible native Julia program by a factor of ∼2 due to the uncomputing overhead . The reversible program shows the advantage of obtaining gradients when the dimension k ≥ 3 . The larger the number of inputs , the more advantage it shows due to the overhead proportional to input size in forward mode AD . The same reason applies to computing Hessians , where the combo of NiLang and ForwardDiff gives the best performance for k ≥ 3 . E Porting NiLang to Zygote Zygote is a popular machine learning package in Julia . We can port NiLang ’ s automatically generated backward rules to Zygote to accelerate some performance-critical functions . The following example shows how to speed up the backward propagation of norm by ∼50 times . Listing 24 : Porting NiLang to Zygote . julia > using Zygote , NiLang , NiLang.AD , BenchmarkTools , LinearAlgebra julia > x = randn ( 1000 ) ; julia > @ benchmark norm ' ( x ) BenchmarkTools.Trial : memory estimate : 339.02 KiB allocs estimate : 8083 -- -- -- -- -- -- -- minimum time : 228.967 µs ( 0.00 % GC ) median time : 237.579 µs ( 0.00 % GC ) mean time : 277.602 µs ( 12.06 % GC ) maximum time : 5.552 ms ( 94.00 % GC ) -- -- -- -- -- -- -- samples : 10000 evals/sample : 1 julia > @ i function r_norm ( out : :T , out2 : :T , x : :AbstractArray { T } ) where T for i=1 : length ( x ) @ inbounds out2 += x [ i ] ^2 end out += sqrt ( out2 ) end julia > Zygote . @ adjoint function norm ( x : :AbstractArray { T } ) where T # compute the forward with regular norm ( might be faster ) out = norm ( x ) # compute the backward with NiLang 's norm , element type is GVar out , δy - > ( grad ( ( ~r_norm ) ( GVar ( out , δy ) , GVar ( out^2 ) , GVar ( x ) ) [ 3 ] ) , ) end julia > @ benchmark norm ' ( x ) BenchmarkTools.Trial : memory estimate : 23.69 KiB allocs estimate : 2 -- -- -- -- -- -- -- minimum time : 4.015 µs ( 0.00 % GC ) median time : 5.171 µs ( 0.00 % GC ) mean time : 6.872 µs ( 13.00 % GC ) maximum time : 380.953 µs ( 93.90 % GC ) -- -- -- -- -- -- -- samples : 10000 evals/sample : 7 We first import the norm function from Julia standard library LinearAlgebra . Zygote ’ s builtin AD engine will generate a slow code and memory allocation of 339KB . Then we write a reversible norm function r_norm with NiLang and port the backward function to Zygote by specifying the backward rule ( the function marked with macro Zygote. @ adjoint ) . Except for the speed up in computing time , the memory allocation also decreases to 23KB , which is equal to the sum of the original x and the array used in backpropagation . ( 1000 × 8 + 1000 × 8 × 2 ) /1024 ≈ 23 The later one has a doubled size because GVar has an extra gradient field . F A benchmark of round-off error in leapfrog Running reversible programming with the floating pointing number system can introduce round-off errors and make the program not reversible . The quantify the effects , we use the leapfrog integrator to compute the orbitals of planets in our solar system as a benchmark . The leapfrog interations can be represented as ~ai = G m j ( ~x j − ~xi ) ‖~xi − ~x j‖3 ( 8 ) ~vi+1/2 = ~vi−1/2 + ~ai∆t ( 9 ) ~xi+1 = ~xi + ~vi+1/2∆t ( 10 ) where G is the gravitational constant and m j is the mass of jth planet , ~x , ~v and ~a are location , velocity and acceleration respectively . The first value of velocity is v1/2 = a0∆t/2 . Since the dynamics of our solar system are symplectic and the leapfrog integrator is time-reversible , the reversible program does not have overheads and the evolution time can go arbitrarily long with constant memory . We compare the mean error in the final axes of the planets and show the results in Fig . 6 . Errors are computed by comparing with the results computed with high precision floating-point numbers . One of the key steps that introduce round-off error is the computation of acceleration . If it is implemented as in Listing . 25 , the round-off error does not bring additional effect in the reversible context , hence we see overlapping lines “ ( regular ) ” and “ ( reversible ) ” in the figure . This is because , when returning a dirty ( not exactly zero cleared due to the floating-point round-off error ) ancilla to the ancilla pool , the small remaining value will be zero-cleared automatically in NiLang . The acceleration function can also be implemented as in Listing . 26 , where the same variable rb is repeatedly used for compute and uncompute , the error will accumulate on this variable . In both Float64 ( double precision floating point ) and Float32 ( single precision floating point ) benchmarks , the results show a much lower precision . Hence , simulating reversible programming with floating-point numbers does not necessarily make the results less reliable if one can avoid cumulative errors in the implementation . Listing 25 : Compute the acceleration . Compute and uncompute on ancilla rc @ i function : ( += ) ( acceleration ) ( y ! : :V3 { T } , ra : :V3 { T } , rb : :V3 { T } , mb : :Real , G ) where T @ routine @ invcheckoff begin @ zeros T d anc1 anc2 anc3 anc4 rc ← zero ( V3 { T } ) d += sqdistance ( ra , rb ) anc1 += sqrt ( d ) anc2 += anc1 ^ 3 anc3 += G * mb anc4 += anc3 / anc2 rc += rb - ra end y ! += anc4 * rc ~ @ routine end Listing 26 : Compute the acceleration . Compute and uncompute on the input variable rb . @ i function : ( += ) ( acceleration ) ( y ! : :V3 { T } , ra : :V3 { T } , rb : :V3 { T } , mb : :Real , G ) where T @ routine @ invcheckoff begin @ zeros T d anc1 anc2 anc3 anc4 d += sqdistance ( ra , rb ) anc1 += sqrt ( d ) anc2 += anc1 ^ 3 anc3 += G * mb anc4 += anc3 / anc2 rb -= ra end y ! += anc4 * rb ~ @ routine # rb is not recovered rigorously ! end G Language Description G.1 Grammar A minimum definition of NiLang ’ s grammar is s a statement s multiple statements c a constant x , y , z symbols i , n integers e julia expression σP [ x 7→ v ] environemnt with x ’ s value equal to v σP [ x 7→ nothing ] environemnt with x undefined σP , e ⇓e v a Julia expression e under environment σP is interpreted as value v σP , s ⇓p σ′P the evaluation of a statement s under environment σP generates environment σ′P σP , s ⇓−1p σ′P the reverse evaluation of a statement s under environment σP generates environment σ′P Statements s : : = ∼s | e ( d∗ ) | x← e | x→ e | @ routine s ; s∗ ; ∼ @ routine | if ( e , e ) s∗ else s∗ end | while ( e , e ) s∗ end | for x = e : e : e s∗ end | begin s∗ end Data views d : : = d . x | d [ e ] | d . e | c | x Reversible functions p : : = @ i function x ( x∗ ) s * end . is the pipe operator in Julia . Here , e is a reversible function and d . e represents a bijection of d. Function arguments are data views , where a data view is a modifiable memory . It can be a variable , a field of a data view , an array element of a data view , or a bijection of a data view . G.2 Operational Semantics The following operational semantics for the forward and backward evaluation shows how a statement is evaluated and reversed . σP , e ⇓e vANCILLA σP [ x 7→ nothing ] , x→ e ⇓p σP [ x 7→ v ] σP , e ⇓e v σP [ x 7→ v ] , x← e ⇓p σP [ x 7→ nothing ] σP , x← e ⇓p σ′P ANCILLA−1 σP , x→ e⇓−1p σ′P σP , x→ e ⇓p σ′P σP , x← e⇓−1p σ′P σP , s1 ⇓p σ′P σ′P , begin s2 · · · sn end ⇓p σ′′PBLOCK σP , begin s1 · · · sn end ⇓p σ′′P σP , begin end ⇓p σP σP , sn⇓−1p σ′P σ′P , begin s1 · · · sn−1 end ⇓−1p σ′′P BLOCK−1 σP , begin s1 · · · sn end ⇓−1p σ′′P σP , begin end ⇓−1p σP σP , e1 ⇓e n1 σP , e2 ⇓e n2 σP , e3 ⇓e n3 ( n1 < = n3 ) == ( n2 > 0 ) σP [ x 7→ n1 ] , s ⇓p σ′P σ′P , for x = e1 + e2 : e2 : e3 s end ⇓p σ′′P FOR σP , for x = e1 : e2 : e3 s end ⇓p σ′′P σP , e1 ⇓e n1 σP , e2 ⇓e n2 σP , e3 ⇓e n3 ( n1 < = n3 ) ! = ( n2 > 0 ) FOR-EXIT σP , for x = e1 : e2 : e3 s end ⇓p σP σP , for x = e3 : −e2 : e1 ∼begin s end end ⇓p σ′P FOR−1 σP , for x = e1 : e2 : e3 s end ⇓−1p σ′P σP , e1 ⇓e true σP , s1 ⇓p σ′P σ′P , e2 ⇓e trueIF-T σP , if ( e1 , e2 ) s1 else s2 end ⇓p σ′P σP , e1 ⇓e f alse σP , s2 ⇓p σ′P σ′P , e2 ⇓e f alseIF-F σP , if ( e1 , e2 ) s1 else s2 end ⇓p σ′P σP , if ( e2 , e1 ) ∼begin s1 end else ∼begin s2 end end ⇓p σ′P IF−1 σP , if ( e1 , e2 ) s1 else s2 end ⇓−1p σ′P σP , e1 ⇓e true σP , e2 ⇓e f alse σP , s ⇓p σ′P σ′P , ( e1 , e2 , s ) ⇓loop σ′′PWHILE σP , while ( e1 , e2 ) s end ⇓p σ′P σP , e2 ⇓e true σP , e1 ⇓e true σP , s ⇓p σ′P σ′P , ( e1 , e2 , s ) ⇓loop σ′′PWHILE-REC σP , ( e1 , e2 , s ) ⇓loop σ′′P σP , e2 ⇓e true σP , e1 ⇓e f alse WHILE-EXIT σP , ( e1 , e2 , s ) ⇓loop σP σP , while ( e2 , e1 ) ∼begin s end end ⇓p σ′P WHILE−1 σP , while ( e1 , e2 ) s end ⇓−1p σ′P σP , s⇓−1p σ′P UNCOMPUTE σP , ∼s ⇓p σ′P σP , s1 ⇓p σ′P σ′P , begin s end ⇓p σ′′P σ′′P , s1⇓−1p σ′′′P COMPUTE-COPY-UNCOMPUTE σP , @ routine s1 ; s ; ∼ @ routine ⇓p σ′′′P σP , @ routine s1 ; ∼begin s end ∼ @ routine ⇓p σ′P COMPUTE-COPY-UNCOMPUTE−1 σP , @ routine s1 ; s ; ∼ @ routine⇓−1p σ′P σP , di ⇓get vi ∅ [ x1 7→ v1 · · · xn 7→ vn ] , ( x1 · · · xn ) = x f ( x1 · · · xn ) ⇓e σP0 [ x1 7→ v′1 · · · xn 7→ v′n ] σPi−1 , v ′ i , di ⇓set σPi CALL σP , x f ( d1 · · · dn ) ⇓p σPn σP , ( ∼x f ) ( d1 · · · dn ) ⇓p σ′P CALL−1 σP , x f ( d1 · · · dn ) ⇓−1p σ′P σP , d ⇓e vGET-VIEW σP , d ⇓get v SET-VIEW-SYM σP , v , x ⇓set σP [ x 7→ v ] z f resh σP [ z 7→ v ] , setindex ! ( d , z , x ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-ARRAY σP , v , d [ x ] ⇓set σ′P z f resh σP [ z 7→ v ] , chfield ( d , x , z ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-FIELD σP , v , d.x ⇓set σ′P z f resh σP [ z 7→ v ] , z . ( ∼e ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-BIJECTOR σP , v , d . e ⇓set σ′P Here , chfield ( x , y , z ) is a Julia function that returns an object similar to x , but with field y modified to value z , setindex ! ( x , z , y ) is a Julia function that sets the yth element of an array x to the value of z . We do not define primitive instructions like d1 = x f ( d2 · · · dn ) , ∈ { + , − , ∗ , / , Y } because these instructions are evaluated as a regular julia expression prime ( , x f ) ( d1 , d2 · · · dn ) = ( d1 x f ( d2 · · · dn ) , d2 · · · dn ) using the above CALL rule , where prime ( , x f ) is a predefined Julia function . To reverse the call , the reverse julia function ∼prime ( , x f ) should also be properly defined . On the other side , any non-primitive NiLang function defintion will generate two Julia functions x f and ∼x f so that it can be used in a recursive definition or other reversible functions . When calling a function , NiLang does not allow the input data views mappings to the same memory , i.e . shared read and write is not allowed . If the same variable is used for shared writing , the result might incorrect . If the same variable is used for both reading and writing , the program will become irreversible . For example , one can not use x -= x to erase a variable , while coding x.y -= x.z is safe . Even if a variables is used for shared reading , it can be dangerous in automatic differentiating . The share read of a variable induces a shared write of its gradient in the adjoint program . For example , y += x * x will not give the correct gradient , but its equivalent forms z ← 0 ; z += x ; y += x * z ; z -= x ; z → 0 and y += x ^2 will . G.3 Compilation The compilation of a reversible function to native Julia functions is consisted of three stages : preprocessing , reversing and translation as shown in Fig . 7 . In the preprocessing stage , the compiler pre-processes human inputs to the reversible NiLang IR . The preprocessor removes eye candies and expands shortcuts to symmetrize the code . In the left most code box in Fig . 7 , one uses @ routine < stmt > statement to record a statement , and ∼ @ routine to insert the corresponding inverse statement for uncomputing . This macro is expanded in the preprocessing stage . In the reversing stage , based on this symmetrized reversible IR , the compiler generates reversed statements . In the translation stage , the compiler translates this reversible IR as well as its inverse to native Julia code . It adds @ assignback before each function call , inserts codes for reversibility check , and handle control flows . The @ assignback macro assigns the outputs of a function to its input data views . As a final step , the compiler attaches a return statement that returns all updated input arguments . Now , the function is ready to execute on the host language .
- This paper presents a new approach to automatic differentiation (AD), namely the use of reversible programming to achieve memory-efficient function inverse and adjoint. The authors have done a good job reviewing the background and laying out the motivation for the new apporach. The implementation is based on adding an embedded DSL to Julia called NiLang. Through reversible programming, NiLang gets rid of the need for checkpointing and hence is amenable to CUDA execution. NiLang is benchmarked against native Julia, ForwardDiff and Tapenade. The performance of NiLang is slightly worse than other approachs in the GMM benchmark. But in the bundle adjustment benchmark, NiLang outperforms ForwardDiff and Tapenade, especially with CUDA acceleration.
SP:2fdd3bcbf3e2c79fc91ccc96527d635ed96ecc9b
Differentiate Everything with a Reversible Domain-Specific Language
1 Introduction Most of the popular automatic differentiation ( AD ) tools in the market , such as TensorFlow ( Abadi et al. , 2015 ) , Pytorch ( Paszke et al. , 2017 ) , and Flux ( Innes et al. , 2018 ) implements reverse mode AD at the tensor level to meet the need in machine learning . Later , People in the scientific computing domain also realized the power of these AD tools , they use these tools to solve scientific problems such as seismic inversion ( Zhu et al. , 2020 ) , variational quantum circuits simulation ( Bergholm et al. , 2018 ; Luo et al. , 2019 ) and variational tensor network simulation ( Liao et al. , 2019 ; Roberts et al. , 2019 ) . To meet the diverse need in these applications , one sometimes has to define backward rules manually , for example 1 . To differentiate sparse matrix operations used in Hamiltonian engineering ( Hao Xie & Wang ) , people defined backward rules for sparse matrix multiplication and dominant eigensolvers ( Golub & Van Loan , 2012 ) , 2 . In tensor network algorithms to study the phase transition problem ( Liao et al. , 2019 ; Seeger et al. , 2017 ; Wan & Zhang , 2019 ; Hubig , 2019 ) , people defined backward rules for singular value decomposition ( SVD ) function and QR decomposition ( Golub & Van Loan , 2012 ) . Instead of defining backward rules manually , one can also use a general purposed AD ( GP-AD ) framework like Tapenade ( Hascoet & Pascual , 2013 ) , OpenAD ( Utke et al. , 2008 ) and Zygote ( Innes , 2018 ; Innes et al. , 2019 ) . Researchers have used these tools in practical applications such as bundle adjustment ( Shen & Dai , 2018 ) and earth system simulation ( Forget et al. , 2015 ) , where differentiating scalar operations is important . However , the power of these tools are often limited by their relatively poor performance . In many practical applications , a program might do billions of computations . In each computational step , the AD engine might cache some data for backpropagation . ( Griewank & Walther , 2008 ) Frequent caching of data slows down the program significantly , while the memory usage will become a bottleneck as well . Caching implicitly also make these frameworks incompatible with kernel functions . To avoid such issues , we need a new GP-AD framework that does not cache automatically for users . In this paper , we propose to implement the reverse mode AD on a reversible ( domain-specific ) programming language ( Perumalla , 2013 ; Frank , 2017 ) , where intermediate states can be traced backward without accessing an implicit stack . Reversible programming allows people to utilize the reversibility to reverse a program . In machine learning , reversibility is proven to substantially decrease the memory usage in unitary recurrent neural networks ( MacKay et al. , 2018 ) , normalizing flow ( Dinh et al. , 2014 ) , hyper-parameter learning ( Maclaurin et al. , 2015 ) and residual neural networks ( Gomez et al. , 2017 ; Behrmann et al. , 2018 ) . Reversible programming will make these happen naturally . The power of reversible programming is not limited to handling these reversible applications , any program can be written in a reversible style . Converting an irreversible program to the reversible form would cost overheads in time and space . Reversible programming provides a flexible time-space trade-off scheme that different with checkpointing ( Griewank , 1992 ; Griewank & Walther , 2008 ; Chen et al. , 2016 ) , reverse computing ( Bennett , 1989 ; Levine & Sherman , 1990 ) , to let user handle these overheads explicitly . There have been many prototypes of reversible languages like Janus ( Lutz , 1986 ) , R ( not the popular one ) ( Frank , 1997 ) , Erlang ( Lanese et al. , 2018 ) and object-oriented ROOPL ( Haulund , 2017 ) . In the past , the primary motivation to study reversible programming is to support reversible computing devices ( Frank & Knight Jr , 1999 ) such as adiabatic complementary metal-oxide-semiconductor ( CMOS ) ( Koller & Athas , 1992 ) , molecular mechanical computing system ( Merkle et al. , 2018 ) and superconducting system ( Likharev , 1977 ; Semenov et al. , 2003 ; Takeuchi et al. , 2014 ; 2017 ) , and these reversible computing devices are orders more energy-efficient . Landauer proves that only when a device does not erase information ( i.e . reversible ) , its energy efficiency can go beyond the thermal dynamic limit . ( Landauer , 1961 ; Reeb & Wolf , 2014 ) However , these reversible programming languages can not be used directly in real scientific computing , since most of them do not have basic elements like floating point numbers , arrays , and complex numbers . This motivates us to build a new embedded domain-specific language ( eDSL ) in Julia ( Bezanson et al. , 2012 ; 2017 ) as a new playground of GP-AD . In this paper , we first compare the time-space trade-off in the optimal checkpointing and the optimal reverse computing in Sec . 2 . Then we introduce the language design of NiLang in Sec . 3 . In Sec . 4 , we explain the implementation of automatic differentiation in NiLang . In Sec . 5 , we benchmark the performance of NiLang ’ s AD with other AD software and explain why it is fast . 2 Reverse computing as an Alternative to Checkpointing One can use either checkpointing or reverse computing to trace back intermediate states of a T - step computational process s1 = f1 ( s0 ) , s2 = f2 ( s1 ) , . . . , sT = fT ( sT−1 ) with a run-time memory S . In the checkpointing scheme , the program first takes snapshots of states at certain time steps S = { sa , sb , . . . } , 1 ≤ a < b < ... ≤ T by running a forward pass . When retrieving a state sk , if sk ∈ S , just return this state , otherwise , return max j s j < k ∈ S and re-compute sk from s j . In the reverse computing scheme , one first writes the program in a reversible style . Without prior knowledge , a regular program can be transpiled to the reversible style is by doing the transformation in Listing . 1 . Listing 1 : Transpiling a regular code to the reversible code without prior knowledge . s1 += f1 ( s0 ) s2 += f2 ( s1 ) . . . sT += fT ( sT−1 ) Listing 2 : The reverse of Listing . 1 sT −= fT ( sT−1 ) . . . s2 −= f2 ( s1 ) s1 −= f1 ( s0 ) Then one can visit states in the reversed order by running the reversed program in Listing . 2 , which erases the computed results from the tail . One may argue that easing through uncomputing is not necessary here . This is not true for a general reversible program , because the intermediate states might be mutable and used in other parts of the program . It is easy to see , both checkpointing and reverse computing can trace back states without time overhead , but both suffer from a space overhead that linear to time ( Table 1 ) . The checkpointing scheme snapshots the output in every step , and the reverse computing scheme allocates extra storage for storing outputs in every step . On the other side , only checkpointing can achieve a zero space overhead by recomputing everything from the beginning s0 , with a time complexity O ( T 2 ) . The minimum space complexity in reverse computing is O ( S log ( T/S ) ) ( Bennett , 1989 ; Levine & Sherman , 1990 ; Perumalla , 2013 ) , with time complexity O ( T 1.585 ) . The difference in space overheads can be explained by the difference of the optimal checkpointing and optimal reverse computing algorithms . The optimal checkpointing algorithm that widely used in AD is the treeverse algorithm in Fig . 1 ( a ) . This algorithm partitions the computational process binomially into d sectors . At the beginning of each sector , the program snapshots the state and push it into a global stack , hence the memory for checkpointing is dS . The states in the last sector are retrieved by the above space-efficient O ( T 2 ) algorithm . After that , the last snapshot can be freed and the program has one more quota in memory . With the freed memory , the second last sector can be further partition into two sectors . Likewise , the lth sectors is partitioned into l sub-sectors , where l is the sector index counting from the tail . Recursively apply this treeverse algorithm t times until the sector size is 1 . The approximated overhead in time and space are Tc = tT , S c = dS , ( 1 ) where T = η ( t , d ) holds . By carefully choosing either a t or d , the overhead in time and space can be both logarithmic . On the other side , the optimal time-space trade-off scheme in reverse computing is the Bennett ’ s algorithm illustrated in Fig . 1 ( b ) . It evenly evenly partition the program into k sectors . The program marches forward ( P process ) for k steps to obtain the final state sk+1 , then backward ( Q process ) from the k − 1th step to erase the states in between s1 < i < k . This process is also called the compute-copyuncompute process . Recursively apply the compute-copy-uncompute process for each sector until each P/Q process contains only one unit computation . the time and space complexities are Tr = T ( T S ) ln ( 2− ( 1/k ) ) ln k , S r = k − 1 ln k S log T S . ( 2 ) Here , the overhead in time is polynomial , which is worse than the treeverse algorithm . The treeverse like partition does not apply here because the first sweep to create initial checkpoints without introducing any space overheads is not possible in reversible computing . The pseudo-code of Bennett ’ s time-space trade-off algorithm is shown in Listing . 3 . Listing 3 : The Bennett ’ s time-space trade-off scheme . The first argument { s1 , ... } is the collection of states , k is the number of partitions , i and len are the starting point and length of the working sector . A function call changes variables inplace . “ ∼ ” is the symbol of uncomputing , which means undoing a function call . Statement si+1 ← 0 allocates a zero state and add it to the state collection . Its inverse si+1 → 0 discards a zero cleared state from the collection . Its NiLang implementation is in Appendix A. bennett ( { s1 , ... } , k , i , len ) if len == 1 si+1 ← 0 fi ( si+1 , si ) else # P process that calls the forward program k steps bennett ( { s1 , ... } , k , i+len÷k * ( j-1 ) , len÷k ) for j=1,2 , ... , k # Q process that calls the backward program k-1 steps ~bennett ( { s1 , ... } , k , i+len÷k * ( j-1 ) , len÷k ) for j=k-1 , k-2 , ... ,1 The reverse computing does not show advantage from the above complexity analysis . But we argue the this analysis is from the worst case , which are very different to the practical using cases . First , τ ! δ ! is the binomial function . ( b ) Bennett ’ s time space trade-off scheme for reverse computing . ( Bennett , 1973 ; Levine & Sherman , 1990 ) P and Q are computing and uncomputing respectively . The pseudo-code is defined in Listing . 3. reverse computing can make use of the reversibility to save memory . In Appendix B.2 , we show how to implement a unitary matrix multiplication without introducing overheads in space and time . Second , reverse computing does not allocate automatically for users , user can optimize the memory access patterns for their own devices like GPU . Third , reverse computing is compatible with effective codes , so that it fits better with modern languages . In Appendix B.1 , we show how to manipulate inplace functions on arrays with NiLang . Fourth , reverse computing can utilize the existing compiler to optimize the code because it does not introduce global stack operations that harm the purity of functions . Fifth , reverse computing encourages users to think reversibly . In Appendix B.3 , we show reversible thinking can lead the user to a constant memory , constant time implementation of chained multiplication algorithms . 3 Language design NiLang is an embedded domain-specific language ( eDSL ) NiLang built on top of the host language Julia ( Bezanson et al. , 2012 ; 2017 ) . Julia is a popular language for scientific programming and machine learning . We choose Julia mainly for speed . Julia is a language with high abstraction , however , its clever design of type inference and just in time compiling make it has a C like speed . Meanwhile , it has rich features for meta-programming . Its package for pattern matching MLStyle allows us to define an eDSL in less than 2000 lines . Comparing with a regular reversible programming language , NiLang features array operations , rich number systems including floating-point numbers , complex numbers , fixed-point numbers , and logarithmic numbers . It also implements the compute-copy-uncompute ( Bennett , 1973 ) macro to increase code reusability . Besides the above reversible hardware compatible features , it also has some reversible hardware incompatible features to meet the practical needs . For example , it views the floating-point + and − operations as reversible . It also allows users to extend instruction sets and sometimes inserting external statements . These features are not compatible with future reversible hardware . NiLang ’ s compiling process , grammar and operational semantics are described in Appendix G. The source code is also available online , we will put a link here after the anonymous open review session . By the time of writing , the version of NiLang is v0.7.3 . 3.1 Reversible functions and instructions Mathematically , any irreversible mapping y = f ( args ... ) can be trivially transformed to its reversible form y += f ( args ... ) or y Y= f ( args ... ) ( Y is the bit-wise XOR ) , where y is a pre-emptied variable . But in numeric computing with finite precision , this is not always true . The reversibility of arithmetic instruction is closely related to the number system . For integer and fixed point number system , y += f ( args ... ) and y -= f ( args ... ) are rigorously reversible . For logarithmic number system and tropical number system ( Speyer & Sturmfels , 2009 ) , y * = f ( args ... ) and y /= f ( args ... ) as reversible ( not introducing the zero element ) . While for floating point numbers , none of the above operations are rigorously reversible . However , for convenience , we ignore the round-off errors in floating-point + and - operations and treat them on equal footing with fixed-point numbers in the following discussion . In Appendix F , we will show doing this is safe in most cases provided careful implementation . Other reversible operations includes SWAP , ROT , NEG et . al. , and this instruction set is extensible . One can define a reversible multiplier in NiLang as in Listing . 4 . Listing 4 : A reversible multiplier julia > using NiLang julia > @ i function multiplier ( y ! : :Real , a : :Real , b : :Real ) y ! += a * b end julia > multiplier ( 2 , 3 , 5 ) ( 17 , 3 , 5 ) julia > ( ~multiplier ) ( 17 , 3 , 5 ) ( 2 , 3 , 5 ) Macro @ i generates two functions that are reversible to each other , multiplier and ∼multiplier , each defines a mapping R3 → R3 . The ! after a symbol is a part of the name , as a conversion to indicate the mutated variables . 3.2 Reversible memory management A distinct feature of reversible memory management is that the content of a variable must be known when it is deallocated . We denote the allocation of a pre-emptied memory as x ← 0 , and its inverse , deallocating a zero emptied variable , as x → 0 . An unknown variable can not be deallocate , but can be pushed to a stack pop out later in the uncomputing stage . If a variable is allocated and deallocated in the local scope , we call it an ancilla . Listing . 5 defines the complex valued accumulative log function . Listing 5 : Reversible complex valued log function y += log ( |x| ) + iArg ( x ) . @ i @ inline function ( : += ) ( log ) ( y ! : :Complex { T } , x : :Complex { T } ) where T n ← zero ( T ) n += abs ( x ) y ! .re += log ( n ) y ! .im += angle ( x ) n -= abs ( x ) n → zero ( T ) end Listing 6 : Compute-copy-uncompute version of Listing . 5 @ i @ inline function ( : += ) ( log ) ( y ! : :Complex { T } , x : :Complex { T } ) where T @ routine begin n ← zero ( T ) n += abs ( x ) end y ! .re += log ( n ) y ! .im += angle ( x ) ~ @ routine end Here , the macro @ inline tells the compiler that this function can be inlined . One can input “ ← ” and “ → ” by typing “ \leftarrow [ TAB KEY ] ” and “ \rightarrow [ TAB KEY ] ” respectively in a Julia editor or REPL . NiLang does not have immutable structs , so that the real part y ! .re and imaginary y ! .im of a complex number can be changed directly . It is easy to verify that the bottom two lines in the function body are the inverse of the top two lines . i.e. , the bottom two lines uncomputes the top two lines . The motivation of uncomputing is to zero clear the contents in ancilla n so that it can be deallocated correctly . Compute-copy-uncompute is a useful design pattern in reversible programming so that we created a pair of macros @ routine and ∼ @ routine for it . One can rewrite the above function as in Listing . 6 . 3.3 Reversible control flows One can define reversible if , for and while statements in a reversible program . Fig . 2 ( a ) shows the flow chart of executing the reversible if statement . There are two condition expressions in this chart , a precondition and a postcondition . The precondition decides which branch to enter in the forward execution , while the postcondition decides which branch to enter in the backward execution . The pseudo-code for the forward and backward passes are shown in Listing . 7 and Listing . 8 . Listing 7 : Translating a reversible if statement ( forward ) branchkeeper = precondition if precondition branch A else branch B end assert branchkeeper == postcondition Listing 8 : Translating a reversible if statement ( backward ) branchkeeper = postcondition if postcondition ~ ( branch A ) else ~ ( branch B ) end assert branchkeeper == precondition Fig . 2 ( b ) shows the flow chart of the reversible while statement . It also has two condition expressions . Before executing the condition expressions , the program presumes the postcondition is false . After each iteration , the program asserts the postcondition to be true . To reverse this statement , one can exchange the precondition and postcondition , and reverse the body statements . The pseudo-code for the forward and backward passes are shown in Listing . 9 and Listing . 10 . Listing 9 : Translating a reversible while statement ( forward ) assert postcondition == false while precondition loop body assert postcondition == true end Listing 10 : Translating a reversible while statement ( backward ) assert precondition == false while postcondition ~ ( loop body ) assert precondition == true end The reversible for statement is similar to the irreversible one except that after execution , the program will assert the iterator to be unchanged . To reverse this statement , one can exchange start and stop and inverse the sign of step . Listing . 11 computes the Fibonacci number recursively and reversibly . Listing 11 : Computing Fibonacci number recursively and reversibly . @ i function rrfib ( out ! , n ) @ invcheckoff if ( n > = 1 , ~ ) counter ← 0 counter += n while ( counter > 1 , counter ! =n ) rrfib ( out ! , counter-1 ) counter -= 2 end counter -= n % 2 counter → 0 end out ! += 1 end Here , out ! is an integer initialized to 0 for storing outputs . The precondition and postcondition are wrapped into a tuple . In the if statement , the postcondition is the same as the precondition , hence we omit the postcondition by inserting a `` ∼ '' in the second field for “ copying the precondition in this field as the postcondition ” . In the while statement , the postcondition is true only for the initial loop . Once code is proven correct , one can turn off the reversibility check by adding @ invcheckoff before a statement . This will remove the reversibility check and make the code faster and compatible with GPU kernels ( kernel functions can not handle exceptions ) . 4 Reversible automatic differentiation 4.1 Back propagation original program O reverse program R gradient program for R comp ute reverse reverse gradient program for O We decompose the problem of reverse mode AD into two sub-problems , reversing the code and computing ∂ [ single input ] ∂ [ multiple outputs ] . Reversing the code is trivial in reversible programming . Computing the gradient here is similar to forward mode automatic differentiation that computes ∂ [ multiple outputs ] ∂ [ single input ] . Inspired by the Julia package ForwardDiff ( Revels et al. , 2016 ) , we use the operator overloading technique to differentiate the program efficiently . In the backward pass , we wrap each output variable with a composite type GVar that containing an extra gradient field , and feed it into the reversed generic program . Instructions are multiple dispatched to corresponding gradient instructions that update the gradient field of GVar at the meantime of uncomputing . By reversing this gradient program , we can obtain the gradient program for the reversed program too . One can define the adjoint ( “ adjoint ” here means the program for back-propagating gradients ) of a primitive instruction as a reversible function on either the function itself or its reverse since the adjoint of a function ’ s reverse is equivalent to the reverse of the function ’ s adjoint . f : ( ~x , ~gx ) → ( ~y , ~gTx ∂~x ∂~y ) ( 3 ) f −1 : ( ~y , ~gy ) → ( ~x , ~gTy ∂~y ∂~x ) ( 4 ) It can be easily verified by applying the above two mappings consecutively , which turns out to be an identity mapping considering ∂~y ∂~x ∂~x ∂~y = 1 . The implementation details are described in Appendix C. In most languages , operator overloading is accompanied with significant overheads of function calls and object allocation and deallocation . But in a language with type inference and just in time compiling like Julia , the boundary between two approaches are vague . The compiler inlines small functions , packs an array of constant sized immutable objects into a continuous memory , and truncates unnecessary branches automatically . 4.2 Hessians Combining forward mode AD and reverse mode AD is a simple yet efficient way to obtain Hessians . By wrapping the elementary type with Dual defined in package ForwardDiff and throwing it into the gradient program defined in NiLang , one obtains one row/column of the Hessian matrix . We will use this approach to compute Hessians in the graph embedding benchmark in Sec . D.2 . 4.3 CUDA kernels CUDA programming is playing a significant role in high-performance computing . In Julia , one can write GPU compatible functions in native Julia language with KernelAbstractions . ( Besard et al. , 2017 ) Since NiLang does not push variables into stack automatically for users , it is safe to write differentiable GPU kernels with NiLang . We will differentiate CUDA kernels with no more than extra 10 lines in the bundle adjustment benchmark in Sec . 5 . 5 Benchmarks We benchmark our framework with the state-of-the-art GP-AD frameworks , including source code transformation based Tapenade and Zygote and operator overloading based ForwardDiff and ReverseDiff . Since most tensor based AD software like famous TensorFlow and PyTorch are not designed for the using cases used in our benchmarks , we do not include those package to avoid an unfair comparison . In the following benchmarks , the CPU device is Intel ( R ) Xeon ( R ) Gold 6230 CPU @ 2.10GHz , and the GPU device is NVIDIA Titan V. For NiLang benchmarks , we have turned the reversibility check off to achieve a better performance . We reproduced the benchmarks for Gaussian mixture model ( GMM ) and bundle adjustment in Srajer et al . ( 2018 ) by re-writing the programs in a reversible style . We show the results in Fig . 3 . The Tapenade data is obtained by executing the docker file provided by the original benchmark , which provides a baseline for comparison . NiLang ’ s objective function is ∼2× slower than normal code due to the uncomputing overhead . In this case , NiLang does not show advantage to Tapenade in obtaining gradients , the ratio between computing the gradients and the objective function are close . This is because the bottleneck of this model is the matrix vector multiplication , traditional AD can already handle this function well . The extra memory used to reverse the program is negligible comparing to the original program as shown in Fig . 4 . The backward pass is not shown here , it is just two times the reversible program in order to store gradients . The data is obtained by counting the main memory allocations in the program manually . The analytical expression of memory usage in unit of floating point number is S = ( 2 + d2 ) k + 2d + P , ( 5 ) S r = ( 3 + d2 + d ) k + 2log2k + P , ( 6 ) where d and k are the size and number of covariance matrices . P = d ( d+1 ) 2 k + k + dk is the size of parameter space . The memory of the dataset ( d×N ) is not included because it will scale as N. Due to the hardness of estimating peak memory usage , the Tapenade data is missing here . The ForwardDiff memory usage is approximately the original size times the batch size , where the batch size is 12 by default . In the bundle adjustment benchmark , NiLang performs the best on CPU . We also compiled our adjoint program to GPU with no more than 10 lines of code with KernelAbstractions , which provides another ∼200× speed up . Parallelizing the adjoint code requires the forward code not reading the same variable simultaneously in different threads , and this requirement is satisfied here . The peak memory of the original program and the reversible program are both equal to the size of parameter space because all “ allocation ” s happen on registers in this application . One can find more benchmarks in Appendix D , including differentiating sparse matrix dot product and obtaining Hessians in the graph embedding application . 6 Discussion In this work , we demonstrate a new approach to back propagates a program called reverse computing AD by designing a reversible eDSL NiLang . NiLang is a powerful tool to differentiate code from the source code level so that can be directly useful to machine learning researches . It can generate efficient backward rules , which is exemplified in Appendix E. It can also be used to differentiate reversible neural networks like normalizing flows ( Kobyzev et al. , 2019 ) to save memory , e.g . backpropagating NICE network ( Dinh et al. , 2014 ) with only constant space overheads . NiLang is most useful in solving large scale scientific problems memory efficiently . In Liu et al . ( 2020 ) , people solve the ground state problem of a 28 × 28 square lattice spin-glass by re-writing the quantum simulator with NiLang . There are some challenges in reverse computing AD too . • The native BLAS and convolution operations in NiLang are not optimized for the memory layout , and are too slow comparing with state of the art machine learning libraries . We need a better implementation of these functions in the reversible programming context so that it can be more useful in training traditional deep neural networks . • Although we show some examples of training neural networks on GPU , the shared-reading of a variable is not allowed . • NiLang ’ s IR does not have variable analysis . The uncomputing pass is not always necessary for the irreversible host language to deallocate memory . In many cases , the host language ’ s variable analysis can figure this out , but it is not guarantted . Another interesting issue is how to make use of reversible computing devices to save energy in machine learning . Reversible computing is not always more energy efficient than irreversible computing . In the time-space trade-off scheme in Sec . 2 , we show the time to uncompute a unit of memory is exponential to n as Qn = ( 2k − 1 ) n , and the computing energy also increases exponentially . On the other side , the amount of energy to erase a unit of memory is a constant . When ( 2k − 1 ) n > 1/ξ , erasing the memory irreversibly is more energy-efficient , where ξ is the energy ratio between a reversible operation ( an instruction or a gate ) and its irreversible counterpart . Acknowledgments The authors are grateful to the people who help improve this work and fundings that sponsored the research . To meet the anonymous criteria , we will add the acknowledgments after the open review session . References Martín Abadi , Ashish Agarwal , Paul Barham , Eugene Brevdo , Zhifeng Chen , Craig Citro , Greg S. Corrado , Andy Davis , Jeffrey Dean , Matthieu Devin , Sanjay Ghemawat , Ian Goodfellow , Andrew Harp , Geoffrey Irving , Michael Isard , Yangqing Jia , Rafal Jozefowicz , Lukasz Kaiser , Manjunath Kudlur , Josh Levenberg , Dandelion Mané , Rajat Monga , Sherry Moore , Derek Murray , Chris Olah , Mike Schuster , Jonathon Shlens , Benoit Steiner , Ilya Sutskever , Kunal Talwar , Paul Tucker , Vincent Vanhoucke , Vijay Vasudevan , Fernanda Viégas , Oriol Vinyals , Pete Warden , Martin Wattenberg , Martin Wicke , Yuan Yu , and Xiaoqiang Zheng . TensorFlow : Large-scale machine learning on heterogeneous systems , 2015 . URL https : //www.tensorflow.org/ . Software available from tensorflow.org . Jens Behrmann , David Duvenaud , and Jörn-Henrik Jacobsen . Invertible residual networks . CoRR , abs/1811.00995 , 2018 . URL http : //arxiv.org/abs/1811.00995 . Charles H. Bennett . Logical reversibility of computation . 1973 . URL https : //ieeexplore . ieee.org/abstract/document/5391327 . Charles H. Bennett . Time/space trade-offs for reversible computation . SIAM Journal on Computing , 18 ( 4 ) :766–776 , 1989. doi : 10.1137/0218053 . URL https : //doi.org/10.1137/0218053 . Ville Bergholm , Josh Izaac , Maria Schuld , Christian Gogolin , M. Sohaib Alam , Shahnawaz Ahmed , Juan Miguel Arrazola , Carsten Blank , Alain Delgado , Soran Jahangiri , Keri McKiernan , Johannes Jakob Meyer , Zeyue Niu , Antal Száva , and Nathan Killoran . Pennylane : Automatic differentiation of hybrid quantum-classical computations , 2018 . URL https : //arxiv.org/ abs/1811.04968 . Tim Besard , Christophe Foket , and Bjorn De Sutter . Effective extensible programming : Unleashing julia on gpus . CoRR , abs/1712.03112 , 2017 . URL http : //arxiv.org/abs/1712.03112 . Jeff Bezanson , Stefan Karpinski , Viral B. Shah , and Alan Edelman . Julia : A fast dynamic language for technical computing , 2012 . URL https : //arxiv.org/abs/1209.5145 . Jeff Bezanson , Alan Edelman , Stefan Karpinski , and Viral B. Shah . Julia : A fresh approach to numerical computing . SIAM Review , 59 ( 1 ) :65–98 , Jan 2017 . ISSN 1095-7200. doi : 10.1137/ 141000671 . URL http : //dx.doi.org/10.1137/141000671 . Tianqi Chen , Bing Xu , Chiyuan Zhang , and Carlos Guestrin . Training deep nets with sublinear memory cost . CoRR , abs/1604.06174 , 2016 . URL http : //arxiv.org/abs/1604.06174 . Laurent Dinh , David Krueger , and Yoshua Bengio . Nice : Non-linear independent components estimation , 2014 . URL https : //arxiv.org/abs/1410.8516 . GAEL Forget , J-M Campin , Patrick Heimbach , Christopher N Hill , Rui M Ponte , and Carl Wunsch . Ecco version 4 : An integrated framework for non-linear inverse modeling and global ocean state estimation . 2015 . URL https : //dspace.mit.edu/handle/1721.1/99660 . Michael P Frank . The r programming language and compiler . Technical report , MIT Reversible Computing Project Memo , 1997 . Michael P. Frank . Throwing computing into reverse . IEEE Spectrum , 54 ( 9 ) :32–37 , Sep 2017 . ISSN 0018-9235. doi : 10.1109/mspec.2017.8012237 . URL http : //dx.doi.org/10.1109/MSPEC . 2017.8012237 . Michael Patrick Frank and Thomas F Knight Jr. Reversibility for efficient computing . PhD thesis , 1999 . URL http : //citeseerx.ist.psu.edu/viewdoc/download ? doi=10.1.1 . 428.4962 & rep=rep1 & type=pdf . Gene H Golub and Charles F Van Loan . Matrix computations , volume 3 . JHU press , 2012 . Aidan N Gomez , Mengye Ren , Raquel Urtasun , and Roger B Grosse . The reversible residual network : Backpropagation without storing activations . 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 . 2214–2224 . Curran Associates , Inc. , 2017 . URL http : //papers.nips.cc/paper/ 6816-the-reversible-residual-network-backpropagation-without-storing-activations . pdf . Andreas Griewank . Achieving logarithmic growth of temporal and spatial complexity in reverse automatic differentiation . Optimization Methods and software , 1 ( 1 ) :35–54 , 1992 . URL https : //www.tandfonline.com/doi/abs/10.1080/10556789208805505 . Andreas Griewank and Andrea Walther . Evaluating derivatives : principles and techniques of algorithmic differentiation . SIAM , 2008 . Jin-Guo Liu Hao Xie and Lei Wang . Automatic differentiation of dominant eigensolver and its applications in quantum physics . URL https : //arxiv.org/abs/2001.04121 . Laurent Hascoet and Valérie Pascual . The tapenade automatic differentiation tool : Principles , model , and specification . ACM Transactions on Mathematical Software ( TOMS ) , 39 ( 3 ) :20 , 2013 . URL https : //dl.acm.org/citation.cfm ? id=2450158 . Tue Haulund . Design and implementation of a reversible object-oriented programming language , 2017 . URL https : //arxiv.org/abs/1707.07845 . Claudius Hubig . Use and implementation of autodifferentiation in tensor network methods with complex scalars , 2019 . URL https : //arxiv.org/abs/1907.13422 . Michael Innes . Don ’ t unroll adjoint : Differentiating ssa-form programs , 2018 . URL https : // arxiv.org/abs/1810.07951 . Michael Innes , Elliot Saba , Keno Fischer , Dhairya Gandhi , Marco Concetto Rudilosso , Neethu Mariya Joy , Tejan Karmali , Avik Pal , and Viral Shah . Fashionable modelling with flux , 2018 . URL https : //arxiv.org/abs/1811.01457 . Mike Innes , Alan Edelman , Keno Fischer , Christopher Rackauckas , Elliot Saba , Viral B. Shah , and Will Tebbutt . A differentiable programming system to bridge machine learning and scientific computing . CoRR , abs/1907.07587 , 2019 . URL http : //arxiv.org/abs/1907.07587 . Li Jing , Yichen Shen , Tena Dubcek , John Peurifoy , Scott Skirlo , Yann LeCun , Max Tegmark , and Marin Soljacić . Tunable efficient unitary neural networks ( eunn ) and their application to rnns , 2016 . URL https : //arxiv.org/abs/1612.05231 . Diederik P Kingma and Jimmy Ba . Adam : A method for stochastic optimization . URL https : //arxiv.org/abs/1412.6980 . Ivan Kobyzev , Simon Prince , and Marcus A. Brubaker . Normalizing flows : An introduction and review of current methods , 2019 . J. G. Koller and W. C. Athas . Adiabatic switching , low energy computing , and the physics of storing and erasing information . In Workshop on Physics and Computation , pp . 267–270 , Oct 1992. doi : 10.1109/PHYCMP.1992.615554 . URL https : //ieeexplore.ieee.org/document/615554 . Rolf Landauer . Irreversibility and heat generation in the computing process . IBM journal of research and development , 5 ( 3 ) :183–191 , 1961 . URL https : //ieeexplore.ieee.org/document/ 5392446 . Ivan Lanese , Naoki Nishida , Adrián Palacios , and Germán Vidal . A theory of reversibility for erlang . Journal of Logical and Algebraic Methods in Programming , 100:71–97 , Nov 2018 . ISSN 2352-2208. doi : 10.1016/j.jlamp.2018.06.004 . URL http : //dx.doi.org/10.1016/ j.jlamp.2018.06.004 . Robert Y Levine and Alan T Sherman . A note on bennett ’ s time-space tradeoff for reversible computation . SIAM Journal on Computing , 19 ( 4 ) :673–677 , 1990 . URL https : //epubs.siam . org/doi/abs/10.1137/0219046 . Hai-Jun Liao , Jin-Guo Liu , Lei Wang , and Tao Xiang . Differentiable programming tensor networks . Physical Review X , 9 ( 3 ) , Sep 2019 . ISSN 2160-3308. doi : 10.1103/physrevx.9.031041 . URL http : //dx.doi.org/10.1103/PhysRevX.9.031041 . K. Likharev . Dynamics of some single flux quantum devices : I. parametric quantron . IEEE Transactions on Magnetics , 13 ( 1 ) :242–244 , January 1977 . ISSN 1941-0069. doi : 10.1109/ TMAG.1977.1059351 . URL https : //ieeexplore.ieee.org/document/1059351 . Jin-Guo Liu , Lei Wang , and Pan Zhang . Tropical tensor network for ground states of spin glasses , 2020 . URL https : //arxiv.org/abs/2008.06888 . Xiu-Zhe Luo , Jin-Guo Liu , Pan Zhang , and Lei Wang . Yao.jl : Extensible , efficient framework for quantum algorithm design , 2019 . URL https : //arxiv.org/abs/1912.10877 . Christopher Lutz . Janus : a time-reversible language . Letter to R . Landauer. , 1986 . Matthew MacKay , Paul Vicol , Jimmy Ba , and Roger B Grosse . Reversible recurrent neural networks . In S. Bengio , H. Wallach , H. Larochelle , K. Grauman , N. CesaBianchi , and R. Garnett ( eds . ) , Advances in Neural Information Processing Systems 31 , pp . 9029–9040 . Curran Associates , Inc. , 2018 . URL http : //papers.nips.cc/paper/ 8117-reversible-recurrent-neural-networks.pdf . Dougal Maclaurin , David Duvenaud , and Ryan Adams . Gradient-based hyperparameter optimization through reversible learning . In Francis Bach and David Blei ( eds . ) , Proceedings of the 32nd International Conference on Machine Learning , volume 37 of Proceedings of Machine Learning Research , pp . 2113–2122 , Lille , France , 07–09 Jul 2015 . PMLR . URL http : //proceedings.mlr.press/v37/maclaurin15.html . Ralph C. Merkle , Robert A. Freitas , Tad Hogg , Thomas E. Moore , Matthew S. Moses , and James Ryley . Mechanical computing systems using only links and rotary joints . Journal of Mechanisms and Robotics , 10 ( 6 ) , Sep 2018 . ISSN 1942-4310. doi : 10.1115/1.4041209 . URL http : //dx . doi.org/10.1115/1.4041209 . 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 . In NIPS Autodiff Workshop , 2017 . URL https : //openreview.net/forum ? id= BJJsrmfCZ . Kalyan S Perumalla . Introduction to reversible computing . Chapman and Hall/CRC , 2013 . David Reeb and Michael M Wolf . An improved landauer principle with finite-size corrections . New Journal of Physics , 16 ( 10 ) :103011 , 2014 . URL https : //iopscience.iop.org/article/ 10.1088/1367-2630/16/10/103011/meta . Jarrett Revels , Miles Lubin , and Theodore Papamarkou . Forward-mode automatic differentiation in julia , 2016 . URL https : //arxiv.org/abs/1607.07892 . Chase Roberts , Ashley Milsted , Martin Ganahl , Adam Zalcman , Bruce Fontaine , Yijian Zou , Jack Hidary , Guifre Vidal , and Stefan Leichenauer . Tensornetwork : A library for physics and machine learning , 2019 . URL https : //arxiv.org/abs/1905.01330 . Matthias Seeger , Asmus Hetzel , Zhenwen Dai , Eric Meissner , and Neil D. Lawrence . Autodifferentiating linear algebra , 2017 . URL https : //arxiv.org/abs/1710.08717 . V. K. Semenov , G. V. Danilov , and D. V. Averin . Negative-inductance squid as the basic element of reversible josephson-junction circuits . IEEE Transactions on Applied Superconductivity , 13 ( 2 ) :938–943 , June 2003 . ISSN 2378-7074. doi : 10.1109/TASC.2003.814155 . URL https : //ieeexplore.ieee.org/document/1211760 . Yan Shen and Yuxing Dai . Fast automatic differentiation for large scale bundle adjustment . IEEE Access , 6:11146–11153 , 2018 . URL https : //ieeexplore.ieee.org/abstract/document/ 8307241/ . David Speyer and Bernd Sturmfels . Tropical mathematics . Mathematics Magazine , 82 ( 3 ) :163– 173 , 2009 . URL https : //www.tandfonline.com/doi/pdf/10.1080/0025570X.2009 . 11953615 . Filip Srajer , Zuzana Kukelova , and Andrew Fitzgibbon . A benchmark of selected algorithmic differentiation tools on some problems in computer vision and machine learning . Optimization Methods and Software , 33 ( 4-6 ) :889–906 , 2018 . URL https : //openreview.net/forum ? id= SMCWZLzTGDN . Jun Takahashi and Anders W. Sandvik . Valence-bond solids , vestigial order , and emergent so ( 5 ) symmetry in a two-dimensional quantum magnet , 2020 . URL https : //arxiv.org/abs/2001 . 10045 . N Takeuchi , Y Yamanashi , and N Yoshikawa . Reversible logic gate using adiabatic superconducting devices . Scientific reports , 4:6354 , 2014 . URL https : //www.nature.com/articles/ srep06354 . Naoki Takeuchi , Yuki Yamanashi , and Nobuyuki Yoshikawa . Reversibility and energy dissipation in adiabatic superconductor logic . Scientific reports , 7 ( 1 ) :1–12 , 2017 . URL https : //www . nature.com/articles/s41598-017-00089-9 . Clay S Turner . A fast binary logarithm algorithm [ dsp tips & tricks ] . IEEE Signal Processing Magazine , 27 ( 5 ) :124–140 , 2010 . URL http : //www.claysturner.com/dsp/binarylogarithm . pdf . Jean Utke , Uwe Naumann , Mike Fagan , Nathan Tallent , Michelle Strout , Patrick Heimbach , Chris Hill , and Carl Wunsch . Openad/f : A modular open-source tool for automatic differentiation of fortran codes . ACM Trans . Math . Softw. , 34 ( 4 ) , July 2008 . ISSN 0098-3500. doi : 10.1145/ 1377596.1377598 . URL https : //doi.org/10.1145/1377596.1377598 . Zhou-Quan Wan and Shi-Xin Zhang . Automatic differentiation for complex valued svd , 2019 . URL https : //arxiv.org/abs/1909.02659 . Weiqiang Zhu , Kailai Xu , Eric Darve , and Gregory C. Beroza . A general approach to seismic inversion with automatic differentiation , 2020 . URL https : //arxiv.org/abs/2003.06027 . A NiLang implementation of Bennett ’ s time-space trade-off algorithm Listing 12 : NiLang implementation of the Bennett ’ s time-space trade-off scheme . using NiLang , Test PROG_COUNTER = Ref ( 0 ) # ( 2k-1 ) ^n PEAK_MEM = Ref ( 0 ) # n * ( k-1 ) +2 @ i function bennett ( f : :AbstractVector , state : :Dict { Int , T } , k : :Int , base , len ) where T if ( len == 1 , ~ ) state [ base+1 ] ← zero ( T ) f [ base ] ( state [ base+1 ] , state [ base ] ) @ safe PROG_COUNTER [ ] += 1 @ safe ( length ( state ) > PEAK_MEM [ ] & & ( PEAK_MEM [ ] = length ( state ) ) ) else n ← 0 n += len÷k # the P process for j=1 : k bennett ( f , state , k , base+n * ( j-1 ) , n ) end # the Q process for j=k-1 : -1:1 ~bennett ( f , state , k , base+n * ( j-1 ) , n ) end n -= len÷k n → 0 end end k = 4 n = 4 N = k ^ n state = Dict ( 1= > 1.0 ) f ( x ) = x * 2.0 instructions = fill ( PlusEq ( f ) , N ) # run the program @ instr bennett ( instructions , state , k , 1 , N ) @ test state [ N+1 ] ≈ 2.0^N & & length ( state ) == 2 @ test PEAK_MEM [ ] == n * ( k-1 ) + 2 @ test PROG_COUNTER [ ] == ( 2 * k-1 ) ^n The input f is a vector of functions and state is a dictionary . We also added some irreversible external statements ( those marked with @ safe ) to help analyse to program . B Cases where reverse computing shows advantage B.1 Handling effective codes Reverse computing can handling effective codes with mutable structures and arrays . For example , the affine transformation can be implemented without any overhead . Listing 13 : Inplace affine transformation . @ i function i_affine ! ( y ! : :AbstractVector { T } , W : :AbstractMatrix { T } , b : :AbstractVector { T } , x : : AbstractVector { T } ) where T @ safe @ assert size ( W ) == ( length ( y ! ) , length ( x ) ) & & length ( b ) == length ( y ! ) @ invcheckoff for j=1 : size ( W , 2 ) for i=1 : size ( W , 1 ) @ inbounds y ! [ i ] += W [ i , j ] * x [ j ] end end @ invcheckoff for i=1 : size ( W , 1 ) @ inbounds y ! [ i ] += b [ i ] end end Here , the expression following the @ safe macro is an external irreversible statement . B.2 Utilizing reversibility Reverse computing can utilize reversibility to trace back states without extra memory cost . For example , we can define the unitary matrix multiplication that can be used in a type of memoryefficient recurrent neural network . ( Jing et al. , 2016 ) Listing 14 : Two level decomposition of a unitary matrix . @ i function i_umm ! ( x ! : :AbstractArray , θ ) M ← size ( x ! , 1 ) N ← size ( x ! , 2 ) k ← 0 @ safe @ assert length ( θ ) == M * ( M-1 ) /2 for l = 1 : N for j=1 : M for i=M-1 : -1 : j INC ( k ) ROT ( x ! [ i , l ] , x ! [ i+1 , l ] , θ [ k ] ) end end end k → length ( θ ) end B.3 Encourages reversible thinking Last but not least , reversible programming encourages users to code in a memory friendly style . Since allocations in reversible programming are explicit , programmers have the flexibility to control how to allocate memory and which number system to use . For example , to compute the power of a positive fixed-point number and an integer , one can easily write irreversible code as in Listing . 15 Listing 15 : A regular power function . function mypower ( x : :T , n : :Int ) where T y = one ( T ) for i=1 : n y * = x end return y end Listing 16 : A reversible power function . @ i function mypower ( out , x : :T , n : :Int ) where T if ( x ! = 0 , ~ ) @ routine begin ly ← one ( ULogarithmic { T } ) lx ← one ( ULogarithmic { T } ) lx * = convert ( x ) for i=1 : n ly * = x end end out += convert ( ly ) ~ @ routine end end Since the fixed-point number is not reversible under * = , naive checkpointing would require stack operations inside a loop . With reversible thinking , we can convert the fixed-point number to logarithmic numbers to utilize the reversibility of * = as shown in Listing . 16 . Here , the algorithm to convert a regular fixed-point number to a logarithmic number can be efficient . ( Turner , 2010 ) C Implementation of AD in NiLang To backpropagate the program , we first reverse the code through source code transformation and then insert the gradient code through operator overloading . If we inline all the functions in Listing . 6 , the function body would be like Listing . 17 . The automatically generated inverse program ( i.e . ( y , x ) → ( y − log ( x ) , x ) ) would be like Listing . 18 . Listing 17 : The inlined function body of Listing . 6 . @ routine begin nsq ← zero ( T ) n ← zero ( T ) nsq += x [ i ] .re ^ 2 nsq += x [ i ] .im ^ 2 n += sqrt ( nsq ) end y ! [ i ] .re += log ( n ) y ! [ i ] .im += atan ( x [ i ] .im , x [ i ] .re ) ~ @ routine Listing 18 : The inverse of Listing . 17 . @ routine begin nsq ← zero ( T ) n ← zero ( T ) nsq += x [ i ] .re ^ 2 nsq += x [ i ] .im ^ 2 n += sqrt ( nsq ) end y ! [ i ] .re -= log ( n ) y ! [ i ] .im -= atan ( x [ i ] .im , x [ i ] .re ) ~ @ routine To compute the adjoint of the computational process in Listing . 17 , one simply insert the gradient code into its inverse in Listing . 18 . The resulting inlined code is show in Listing . 19 . Listing 19 : Insert the gradient code into Listing . 18 , the original computational processes are highlighted in yellow background . @ routine begin nsq ← zero ( GVar { T , T } ) n ← zero ( GVar { T , T } ) gsqa ← zero ( T ) gsqa += x [ i ] .re.x * 2 x [ i ] .re.g -= gsqa * nsq.g gsqa -= nsq.x * 2 gsqa -= x [ i ] .re.x * 2 gsqa → zero ( T ) nsq.x += x [ i ] .re.x ^2 gsqb ← zero ( T ) gsqb += x [ i ] .im.x * 2 x [ i ] .im.g -= gsqb * nsq.g gsqb -= x [ i ] .im.x * 2 gsqb → zero ( T ) nsq.x += x [ i ] .im.x ^2 @ zeros T ra rb rta += sqrt ( nsq.x ) rb += 2 * ra nsq.g -= n.g / rb rb -= 2 * ra ra -= sqrt ( nsq.x ) ~ @ zeros T ra rb n.x += sqrt ( nsq.x ) end y ! [ i ] .re.x -= log ( n.x ) n.g += y ! [ i ] .re.g / n.x y ! [ i ] .im.x-=atan ( x [ i ] .im.x , x [ i ] .re.x ) @ zeros T xy2 jac_x jac_y xy2 += abs2 ( x [ i ] .re.x ) xy2 += abs2 ( x [ i ] .im.x ) jac_y += x [ i ] .re.x / xy2 jac_x += ( -x [ i ] .im.x ) / xy2 x [ i ] .im.g += y ! [ i ] .im.g * jac_y x [ i ] .re.g += y ! [ i ] .im.g * jac_x jac_x -= ( -x [ i ] .im.x ) / xy2 jac_y -= x [ i ] .re.x / xy2 xy2 -= abs2 ( x [ i ] .im.x ) xy2 -= abs2 ( x [ i ] .re.x ) ~ @ zeros T xy2 jac_x jac_y ~ @ routine Here , @ zeros TYPE var1 var2 ... is the macro to allocate multiple variables of the same type . Its inverse operations starts with ∼ @ zeros deallocates zero emptied variables . In practice , “ inserting gradients ” is not achieved by source code transformation , but by operator overloading . We change the element type to a composite type GVar with two fields , value x and gradient g. With multiple dispatching primitive instructions on this new type , values and gradients can be updated simultaneously . Although the code looks much longer , the computing time ( with reversibility check closed ) is not . Listing 20 : Time and allocation to differentiate complex valued log . julia > using NiLang , NiLang.AD , BenchmarkTools julia > @ inline function ( ir_log ) ( x : :Complex { T } ) where T log ( abs ( x ) ) + im * angle ( x ) end julia > @ btime ir_log ( x ) setup= ( x=1.0+1.2im ) ; # native code 30.097 ns ( 0 allocations : 0 bytes ) julia > @ btime ( @ instr y += log ( x ) ) setup= ( x=1.0+1.2im ; y=0.0+0.0im ) ; # reversible code 17.542 ns ( 0 allocations : 0 bytes ) julia > @ btime ( @ instr ~ ( y += log ( x ) ) ) setup= ( x=GVar ( 1.0+1.2im , 0.0+0.0im ) ; y=GVar ( 0.1+0.2im , 1.0+0.0im ) ) ; # adjoint code 25.932 ns ( 0 allocations : 0 bytes ) The performance is unreasonably good because the generated Julia code is further compiled to LLVM so that it can enjoy existing optimization passes . For example , the optimization passes can find out that for an irreversible device , uncomputing local variables n and nsq to zeros does not affect return values , so that it will ignore the uncomputing process automatically . Unlike checkpointing based approaches that focus a lot in the optimization of data caching on a global stack , NiLang does not have any optimization pass in itself . Instead , it throws itself to existing optimization passes in Julia . Without accessing the global stack , NiLang ’ s code is quite friendly to optimization passes . In this case , we also see the boundary between source code transformation and operator overloading can be vague in a Julia , in that the generated code can be very different from how it looks . The joint functions for primitive instructions ( : += ) ( sqrt ) and ( : -= ) ( sqrt ) used above can be defined as in Listing . 21 . Listing 21 : Adjoints for primitives ( : += ) ( sqrt ) and ( : -= ) ( sqrt ) . @ i @ inline function ( : -= ) ( sqrt ) ( out ! : :GVar , x : :GVar { T } ) where T @ routine @ invcheckoff begin @ zeros T a b a += sqrt ( x.x ) b += 2 * a end out ! .x -= a x.g += out ! .g / b ~ @ routine end D More Benchmarks D.1 Sparse matrices We compare the call , uncall and backward propagation time used for sparse matrix dot product and matrix multiplication in Table 2 . Their reversible implementations are shown in Listing . 22 and Listing . 23 . The computing time for backward propagation is approximately 1.5-3 times the Julia ’ s native forward pass , which is close to the theoretical optimal performance . Listing 22 : Reversible sparse matrix multiplication . using SparseArrays @ i function i_dot ( r : :T , A : :SparseMatrixCSC { T } , B : :SparseMatrixCSC { T } ) where { T } m ← size ( A , 1 ) n ← size ( A , 2 ) @ invcheckoff branch_keeper ← zeros ( Bool , 2 * m ) @ safe size ( B ) == ( m , n ) || throw ( DimensionMismatch ( `` matrices must have the same dimensions '' ) ) @ invcheckoff @ inbounds for j = 1 : n ia1 ← A.colptr [ j ] ib1 ← B.colptr [ j ] ia2 ← A.colptr [ j+1 ] ib2 ← B.colptr [ j+1 ] ia ← ia1 ib ← ib1 @ inbounds for i=1 : ia2-ia1+ib2-ib1-1 ra ← A.rowval [ ia ] rb ← B.rowval [ ib ] if ( ra == rb , ~ ) r += A.nzval [ ia ] ' * B.nzval [ ib ] end # # b move - > true , a move - > false branch_keeper [ i ] Y= ia == ia2-1 || ( ib ! = ib2-1 & & ra > rb ) ra → A.rowval [ ia ] rb → B.rowval [ ib ] if ( branch_keeper [ i ] , ~ ) INC ( ib ) else INC ( ia ) end end ~ @ inbounds for i=1 : ia2-ia1+ib2-ib1-1 # # b move - > true , a move - > false branch_keeper [ i ] Y= ia == ia2-1 || ( ib ! = ib2-1 & & A.rowval [ ia ] > B.rowval [ ib ] ) if ( branch_keeper [ i ] , ~ ) INC ( ib ) else INC ( ia ) end end end @ invcheckoff branch_keeper → zeros ( Bool , 2 * m ) end Listing 23 : Reversible sparse matrix dot-product . @ i function i_mul ! ( C : :StridedVecOrMat , A : :AbstractSparseMatrix , B : :StridedVector { T } , α : : Number , β : :Number ) where T @ safe size ( A , 2 ) == size ( B , 1 ) || throw ( DimensionMismatch ( ) ) @ safe size ( A , 1 ) == size ( C , 1 ) || throw ( DimensionMismatch ( ) ) @ safe size ( B , 2 ) == size ( C , 2 ) || throw ( DimensionMismatch ( ) ) nzv ← nonzeros ( A ) rv ← rowvals ( A ) if ( β ! = 1 , ~ ) @ safe error ( `` only β = 1 is supported , got β = $ ( β ) . '' ) end # Here , we close the reversibility check inside the loop to increase performance @ invcheckoff for k = 1 : size ( C , 2 ) @ inbounds for col = 1 : size ( A , 2 ) αxj ← zero ( T ) αxj += B [ col , k ] * α for j = SparseArrays.getcolptr ( A ) [ col ] : ( SparseArrays.getcolptr ( A ) [ col + 1 ] - 1 ) C [ rv [ j ] , k ] += nzv [ j ] * αxj end αxj -= B [ col , k ] * α end end end D.2 Graph embedding problem Graph embedding can be used to find a proper representation for an order parameter ( Takahashi & Sandvik , 2020 ) in condensed matter physics . People want to find a minimum Euclidean space dimension k that a Petersen graph can embed into , that the distances between pairs of connected vertices are l1 , and the distance between pairs of disconnected vertices are l2 , where l2 > l1 . The Petersen graph is shown in Fig . 5 . Let us denote the set of connected and disconnected vertex pairs as L1 and L2 , respectively . This problem can be variationally solved with the following loss . L = Var ( dist ( L1 ) ) + Var ( dist ( L2 ) ) + exp ( relu ( dist ( L1 ) − dist ( L2 ) + 0.1 ) ) ) − 1 ( 7 ) The first line is a summation of distance variances in two sets of vertex pairs , where Var ( X ) is the variance of samples in X . The second line is used to guarantee l2 > l1 , where X means taking the average of samples in X . Its reversible implementation could be found in our benchmark repository . We repeat the training for dimension k from 1 to 10 . In each training , we fix two of the vertices and optimize the positions of the rest . Otherwise , the program will find the trivial solution with overlapped vertices . For k < 5 , the loss is always much higher than 0 , while for k ≥ 5 , we can get a loss close to machine precision with high probability . From the k = 5 solution , it is easy to see l2/l1 = √ 2 . An Adam optimizer with a learning rate 0.01 ( Kingma & Ba ) requires ∼2000 steps training . The trust region Newton ’ s method converges much faster , which requires∼20 computations of Hessians to reach convergence . Although training time is comparable , the converged precision of the later is much better . Since one can combine ForwardDiff and NiLang to obtain Hessians , it is interesting to see how much performance we can get in differentiating the graph embedding program . In Table 3 , we show the the performance of different implementations by varying the dimension k. The number of parameters is 10k . As the baseline , ( a ) shows the time for computing the function call . We have reversible and irreversible implementations , where the reversible program is slower than the irreversible native Julia program by a factor of ∼2 due to the uncomputing overhead . The reversible program shows the advantage of obtaining gradients when the dimension k ≥ 3 . The larger the number of inputs , the more advantage it shows due to the overhead proportional to input size in forward mode AD . The same reason applies to computing Hessians , where the combo of NiLang and ForwardDiff gives the best performance for k ≥ 3 . E Porting NiLang to Zygote Zygote is a popular machine learning package in Julia . We can port NiLang ’ s automatically generated backward rules to Zygote to accelerate some performance-critical functions . The following example shows how to speed up the backward propagation of norm by ∼50 times . Listing 24 : Porting NiLang to Zygote . julia > using Zygote , NiLang , NiLang.AD , BenchmarkTools , LinearAlgebra julia > x = randn ( 1000 ) ; julia > @ benchmark norm ' ( x ) BenchmarkTools.Trial : memory estimate : 339.02 KiB allocs estimate : 8083 -- -- -- -- -- -- -- minimum time : 228.967 µs ( 0.00 % GC ) median time : 237.579 µs ( 0.00 % GC ) mean time : 277.602 µs ( 12.06 % GC ) maximum time : 5.552 ms ( 94.00 % GC ) -- -- -- -- -- -- -- samples : 10000 evals/sample : 1 julia > @ i function r_norm ( out : :T , out2 : :T , x : :AbstractArray { T } ) where T for i=1 : length ( x ) @ inbounds out2 += x [ i ] ^2 end out += sqrt ( out2 ) end julia > Zygote . @ adjoint function norm ( x : :AbstractArray { T } ) where T # compute the forward with regular norm ( might be faster ) out = norm ( x ) # compute the backward with NiLang 's norm , element type is GVar out , δy - > ( grad ( ( ~r_norm ) ( GVar ( out , δy ) , GVar ( out^2 ) , GVar ( x ) ) [ 3 ] ) , ) end julia > @ benchmark norm ' ( x ) BenchmarkTools.Trial : memory estimate : 23.69 KiB allocs estimate : 2 -- -- -- -- -- -- -- minimum time : 4.015 µs ( 0.00 % GC ) median time : 5.171 µs ( 0.00 % GC ) mean time : 6.872 µs ( 13.00 % GC ) maximum time : 380.953 µs ( 93.90 % GC ) -- -- -- -- -- -- -- samples : 10000 evals/sample : 7 We first import the norm function from Julia standard library LinearAlgebra . Zygote ’ s builtin AD engine will generate a slow code and memory allocation of 339KB . Then we write a reversible norm function r_norm with NiLang and port the backward function to Zygote by specifying the backward rule ( the function marked with macro Zygote. @ adjoint ) . Except for the speed up in computing time , the memory allocation also decreases to 23KB , which is equal to the sum of the original x and the array used in backpropagation . ( 1000 × 8 + 1000 × 8 × 2 ) /1024 ≈ 23 The later one has a doubled size because GVar has an extra gradient field . F A benchmark of round-off error in leapfrog Running reversible programming with the floating pointing number system can introduce round-off errors and make the program not reversible . The quantify the effects , we use the leapfrog integrator to compute the orbitals of planets in our solar system as a benchmark . The leapfrog interations can be represented as ~ai = G m j ( ~x j − ~xi ) ‖~xi − ~x j‖3 ( 8 ) ~vi+1/2 = ~vi−1/2 + ~ai∆t ( 9 ) ~xi+1 = ~xi + ~vi+1/2∆t ( 10 ) where G is the gravitational constant and m j is the mass of jth planet , ~x , ~v and ~a are location , velocity and acceleration respectively . The first value of velocity is v1/2 = a0∆t/2 . Since the dynamics of our solar system are symplectic and the leapfrog integrator is time-reversible , the reversible program does not have overheads and the evolution time can go arbitrarily long with constant memory . We compare the mean error in the final axes of the planets and show the results in Fig . 6 . Errors are computed by comparing with the results computed with high precision floating-point numbers . One of the key steps that introduce round-off error is the computation of acceleration . If it is implemented as in Listing . 25 , the round-off error does not bring additional effect in the reversible context , hence we see overlapping lines “ ( regular ) ” and “ ( reversible ) ” in the figure . This is because , when returning a dirty ( not exactly zero cleared due to the floating-point round-off error ) ancilla to the ancilla pool , the small remaining value will be zero-cleared automatically in NiLang . The acceleration function can also be implemented as in Listing . 26 , where the same variable rb is repeatedly used for compute and uncompute , the error will accumulate on this variable . In both Float64 ( double precision floating point ) and Float32 ( single precision floating point ) benchmarks , the results show a much lower precision . Hence , simulating reversible programming with floating-point numbers does not necessarily make the results less reliable if one can avoid cumulative errors in the implementation . Listing 25 : Compute the acceleration . Compute and uncompute on ancilla rc @ i function : ( += ) ( acceleration ) ( y ! : :V3 { T } , ra : :V3 { T } , rb : :V3 { T } , mb : :Real , G ) where T @ routine @ invcheckoff begin @ zeros T d anc1 anc2 anc3 anc4 rc ← zero ( V3 { T } ) d += sqdistance ( ra , rb ) anc1 += sqrt ( d ) anc2 += anc1 ^ 3 anc3 += G * mb anc4 += anc3 / anc2 rc += rb - ra end y ! += anc4 * rc ~ @ routine end Listing 26 : Compute the acceleration . Compute and uncompute on the input variable rb . @ i function : ( += ) ( acceleration ) ( y ! : :V3 { T } , ra : :V3 { T } , rb : :V3 { T } , mb : :Real , G ) where T @ routine @ invcheckoff begin @ zeros T d anc1 anc2 anc3 anc4 d += sqdistance ( ra , rb ) anc1 += sqrt ( d ) anc2 += anc1 ^ 3 anc3 += G * mb anc4 += anc3 / anc2 rb -= ra end y ! += anc4 * rb ~ @ routine # rb is not recovered rigorously ! end G Language Description G.1 Grammar A minimum definition of NiLang ’ s grammar is s a statement s multiple statements c a constant x , y , z symbols i , n integers e julia expression σP [ x 7→ v ] environemnt with x ’ s value equal to v σP [ x 7→ nothing ] environemnt with x undefined σP , e ⇓e v a Julia expression e under environment σP is interpreted as value v σP , s ⇓p σ′P the evaluation of a statement s under environment σP generates environment σ′P σP , s ⇓−1p σ′P the reverse evaluation of a statement s under environment σP generates environment σ′P Statements s : : = ∼s | e ( d∗ ) | x← e | x→ e | @ routine s ; s∗ ; ∼ @ routine | if ( e , e ) s∗ else s∗ end | while ( e , e ) s∗ end | for x = e : e : e s∗ end | begin s∗ end Data views d : : = d . x | d [ e ] | d . e | c | x Reversible functions p : : = @ i function x ( x∗ ) s * end . is the pipe operator in Julia . Here , e is a reversible function and d . e represents a bijection of d. Function arguments are data views , where a data view is a modifiable memory . It can be a variable , a field of a data view , an array element of a data view , or a bijection of a data view . G.2 Operational Semantics The following operational semantics for the forward and backward evaluation shows how a statement is evaluated and reversed . σP , e ⇓e vANCILLA σP [ x 7→ nothing ] , x→ e ⇓p σP [ x 7→ v ] σP , e ⇓e v σP [ x 7→ v ] , x← e ⇓p σP [ x 7→ nothing ] σP , x← e ⇓p σ′P ANCILLA−1 σP , x→ e⇓−1p σ′P σP , x→ e ⇓p σ′P σP , x← e⇓−1p σ′P σP , s1 ⇓p σ′P σ′P , begin s2 · · · sn end ⇓p σ′′PBLOCK σP , begin s1 · · · sn end ⇓p σ′′P σP , begin end ⇓p σP σP , sn⇓−1p σ′P σ′P , begin s1 · · · sn−1 end ⇓−1p σ′′P BLOCK−1 σP , begin s1 · · · sn end ⇓−1p σ′′P σP , begin end ⇓−1p σP σP , e1 ⇓e n1 σP , e2 ⇓e n2 σP , e3 ⇓e n3 ( n1 < = n3 ) == ( n2 > 0 ) σP [ x 7→ n1 ] , s ⇓p σ′P σ′P , for x = e1 + e2 : e2 : e3 s end ⇓p σ′′P FOR σP , for x = e1 : e2 : e3 s end ⇓p σ′′P σP , e1 ⇓e n1 σP , e2 ⇓e n2 σP , e3 ⇓e n3 ( n1 < = n3 ) ! = ( n2 > 0 ) FOR-EXIT σP , for x = e1 : e2 : e3 s end ⇓p σP σP , for x = e3 : −e2 : e1 ∼begin s end end ⇓p σ′P FOR−1 σP , for x = e1 : e2 : e3 s end ⇓−1p σ′P σP , e1 ⇓e true σP , s1 ⇓p σ′P σ′P , e2 ⇓e trueIF-T σP , if ( e1 , e2 ) s1 else s2 end ⇓p σ′P σP , e1 ⇓e f alse σP , s2 ⇓p σ′P σ′P , e2 ⇓e f alseIF-F σP , if ( e1 , e2 ) s1 else s2 end ⇓p σ′P σP , if ( e2 , e1 ) ∼begin s1 end else ∼begin s2 end end ⇓p σ′P IF−1 σP , if ( e1 , e2 ) s1 else s2 end ⇓−1p σ′P σP , e1 ⇓e true σP , e2 ⇓e f alse σP , s ⇓p σ′P σ′P , ( e1 , e2 , s ) ⇓loop σ′′PWHILE σP , while ( e1 , e2 ) s end ⇓p σ′P σP , e2 ⇓e true σP , e1 ⇓e true σP , s ⇓p σ′P σ′P , ( e1 , e2 , s ) ⇓loop σ′′PWHILE-REC σP , ( e1 , e2 , s ) ⇓loop σ′′P σP , e2 ⇓e true σP , e1 ⇓e f alse WHILE-EXIT σP , ( e1 , e2 , s ) ⇓loop σP σP , while ( e2 , e1 ) ∼begin s end end ⇓p σ′P WHILE−1 σP , while ( e1 , e2 ) s end ⇓−1p σ′P σP , s⇓−1p σ′P UNCOMPUTE σP , ∼s ⇓p σ′P σP , s1 ⇓p σ′P σ′P , begin s end ⇓p σ′′P σ′′P , s1⇓−1p σ′′′P COMPUTE-COPY-UNCOMPUTE σP , @ routine s1 ; s ; ∼ @ routine ⇓p σ′′′P σP , @ routine s1 ; ∼begin s end ∼ @ routine ⇓p σ′P COMPUTE-COPY-UNCOMPUTE−1 σP , @ routine s1 ; s ; ∼ @ routine⇓−1p σ′P σP , di ⇓get vi ∅ [ x1 7→ v1 · · · xn 7→ vn ] , ( x1 · · · xn ) = x f ( x1 · · · xn ) ⇓e σP0 [ x1 7→ v′1 · · · xn 7→ v′n ] σPi−1 , v ′ i , di ⇓set σPi CALL σP , x f ( d1 · · · dn ) ⇓p σPn σP , ( ∼x f ) ( d1 · · · dn ) ⇓p σ′P CALL−1 σP , x f ( d1 · · · dn ) ⇓−1p σ′P σP , d ⇓e vGET-VIEW σP , d ⇓get v SET-VIEW-SYM σP , v , x ⇓set σP [ x 7→ v ] z f resh σP [ z 7→ v ] , setindex ! ( d , z , x ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-ARRAY σP , v , d [ x ] ⇓set σ′P z f resh σP [ z 7→ v ] , chfield ( d , x , z ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-FIELD σP , v , d.x ⇓set σ′P z f resh σP [ z 7→ v ] , z . ( ∼e ) ⇓e v′ σP , v′ , d ⇓set σ′PSET-VIEW-BIJECTOR σP , v , d . e ⇓set σ′P Here , chfield ( x , y , z ) is a Julia function that returns an object similar to x , but with field y modified to value z , setindex ! ( x , z , y ) is a Julia function that sets the yth element of an array x to the value of z . We do not define primitive instructions like d1 = x f ( d2 · · · dn ) , ∈ { + , − , ∗ , / , Y } because these instructions are evaluated as a regular julia expression prime ( , x f ) ( d1 , d2 · · · dn ) = ( d1 x f ( d2 · · · dn ) , d2 · · · dn ) using the above CALL rule , where prime ( , x f ) is a predefined Julia function . To reverse the call , the reverse julia function ∼prime ( , x f ) should also be properly defined . On the other side , any non-primitive NiLang function defintion will generate two Julia functions x f and ∼x f so that it can be used in a recursive definition or other reversible functions . When calling a function , NiLang does not allow the input data views mappings to the same memory , i.e . shared read and write is not allowed . If the same variable is used for shared writing , the result might incorrect . If the same variable is used for both reading and writing , the program will become irreversible . For example , one can not use x -= x to erase a variable , while coding x.y -= x.z is safe . Even if a variables is used for shared reading , it can be dangerous in automatic differentiating . The share read of a variable induces a shared write of its gradient in the adjoint program . For example , y += x * x will not give the correct gradient , but its equivalent forms z ← 0 ; z += x ; y += x * z ; z -= x ; z → 0 and y += x ^2 will . G.3 Compilation The compilation of a reversible function to native Julia functions is consisted of three stages : preprocessing , reversing and translation as shown in Fig . 7 . In the preprocessing stage , the compiler pre-processes human inputs to the reversible NiLang IR . The preprocessor removes eye candies and expands shortcuts to symmetrize the code . In the left most code box in Fig . 7 , one uses @ routine < stmt > statement to record a statement , and ∼ @ routine to insert the corresponding inverse statement for uncomputing . This macro is expanded in the preprocessing stage . In the reversing stage , based on this symmetrized reversible IR , the compiler generates reversed statements . In the translation stage , the compiler translates this reversible IR as well as its inverse to native Julia code . It adds @ assignback before each function call , inserts codes for reversibility check , and handle control flows . The @ assignback macro assigns the outputs of a function to its input data views . As a final step , the compiler attaches a return statement that returns all updated input arguments . Now , the function is ready to execute on the host language .
The paper adapts reversible computing techniques to compute gradients. The techniques presented are not new though the Julia based DSL is new. The results presented are for differentiating through a GMM. It is not clear if the technique scale to a modern day neural network models and how they will integrate into current frameworks like JAX, PyTorch or TensorFlow.
SP:2fdd3bcbf3e2c79fc91ccc96527d635ed96ecc9b
On the Robustness of Sentiment Analysis for Stock Price Forecasting
1 INTRODUCTION . Research on the vulnerability of machine learning ( ML ) to adversarial examples ( Biggio et al. , 2013 ; Szegedy et al. , 2013 ) focused , with few exceptions ( Kurakin et al. , 2016 ; Brown et al. , 2017 ) , on adversaries with immediate control over the inputs to an ML model . Yet , ML systems are often applied on large corpora of data collected from sources only partially under the control of adversaries . Recent advances in language modelling ( Devlin et al. , 2019 ; Brown et al. , 2020 ) illustrate this well : they rely on training large architectures on unstructured corpora of text crawled from the Internet . This raises a natural question : when the provenance of train or test inputs to ML systems is ill defined , does this advantage model developers or adversaries ? Here , by provenance we refer to a detailed history of the flow of information into a computer system ( Muniswamy-Reddy et al. ) . We study the example of such an ML system for stock price forecasting . In this application , ML predictions can both serve as inputs to algorithmic trading or to assist human traders . We choose the example of stock price forecasting because it involves several structured applications of ML , including sentiment analysis over a spectrum of public information sources ( e.g. , news , Twitter , etc . ) with little provenance guarantees . There is also a long history of leveraging knowledge inaccessible to all market participants to gain an edge in predicting the prices of securities . Thales used his knowledge of astronomy to corner the market in olive-oil presses and generate a profit . We first reproduce an ML pipeline for stock price prediction , inspired by practices common in the industry . We note that choosing the right time scale is of paramount importance . ML is better suited for low frequency intra-day and weekly trading than high-frequency trading , because the latter requires decision speeds much faster than achievable by ML hardware accelerators . Although there has been prior work on attacking ML for high-frequency trading ( Goldblum et al. , 2020 ) , their experimental setting is 7 orders of magnitude slower than NASDAQ timestamps ( NASDAQ ; 2020 ) , which high-frequency trading firms use . In contrast , ML in low-frequency trading has attracted greater practical interest of the industry , with two major finance data vendors vastly expanding their sentiment data API offerings in the past decade ( Bloomberg , 2017 ; Reuters , 2014 ) . This is to serve the growing demand from institutional and advanced retail market players to use ML models for sentiment analysis at lower frequencies . We adopt this low frequency setting , and collect our data from Twitter and Yahoo finance , which provides 1-minute frequency stock price data . Using these services , we collected tweets related to Tesla and Tesla ’ s stock prices over 3.5 years . We then used FinBERT ( Araci , 2019 ) , a financial sentiment classifier to extract sentiment-based features from every tweet . We describe these methods in more depth in Section 3.1 ; they are general and applicable to any company of interest . We use sentiment features as our input and the change in price as our target to train multiple probabilistic forecasting models . We show that including sentiment features extracted from Twitter can reduce the mean absolute error of a model that only learns from historical stock prices by half . Section 3.2 introduces the probabilistic models used in our work . Predicting stock prices is a known hard task . Even a limited , per trade edge can lead to a large gain when scaled by the number of trades preformed ( Laughlin , 2014 ) . Moreover , typically sentiment analysis is only one of many indicators used in a trade decision . Hence our model only needs to provide a slight non-trivial advantage over random baselines to be effective in practice . We used our forecasts to implement portfolio strategies with positive returns , and measure its performance across other metrics to showcase its advantage . Equipped with this realistic ML pipeline for stock price forecasting , which takes input data from a source with little provenance guarantees ( i.e. , Twitter ) , we set out to study its robustness . Unlike previous settings of adversarial examples like vision , where the realistic incentives for an adversary to change the classification is often unclear ( Gilmer et al. , 2018 ) , in our setting there are clear financial interests at stake . Furthermore , Twitter is already subject to vast disinformation campaigns ( Zannettou et al. , 2019 ) . These make it even more complicated to assess the provenance of data analyzed by ML pipelines . To investigate the robustness of our stock price prediction pipeline , we use adversarial examples to show that our financial sentiment analysis model is brittle in this setting . While attacks against NLP models are not new in research settings , our work demonstrates the practical impacts that attacks on an NLP component ( i.e. , sentiment analysis ) of a system can have on downstream tasks like stock price prediction . We show that an adversary can significantly manipulate the forecasted distribution ‘ s parameters in a targeted direction , while perturbing the sentiment features minimally at test time only . An adversary would determine a parameter and direction , such as increasing variance of forecasted stock prices , and compute a corresponding perturbation . If given control over training data , the adversary ’ s capabilities would only further increase . The contributions of this paper are the following : • We propose a realistic setting for adversarial examples through the task of sentiment analysis for stock price forecasting . We develop a dataset collection pipeline using ticker data and Twitter discussion , for any ticker ( i.e. , company ) . This includes querying Twitter , processing data into a format fit for training , and a suitable sentiment analysis model . • We implement different sentiment-based probabilistic forecasting models that are able to perform better then a naive approach in forecasting stock price changes given Twitter discussion surrounding the company . DeepAR-G , a Gaussian probabilistic forecasting model , outperformed all other models in our experiments . • We subject our pipeline to adversarial manipulation , leveraging information from our model to minimally modify its inputs into adversarial examples , while achieving important changes in our model ’ s output such as shifting distribution parameters of our probability distribution in any direction we wish . We intend to release our code and data should the manuscript be accepted . Beyond the implications of our findings in settings where an adversary is present , we stress that capturing model performance in the worst case setting is important for the domain of finance . These threats are very real : past market anomalies led to the collapse of the Knight Capital Group , and there were legal matters following the suspected manipulation of Tesla stock via Twitter . Therefore , it is important for financial institutions to understand how their ML systems could behave in worst-case settings , lest market anomalies impact these systems in unprecedented ways . Furthermore , unforeseen catastrophic events ( e.g. , a natural disaster or pandemic ) are often hard to model via standard testing procedures be it order generation simulators or backtesting , i.e . simulating trading on replayed past data . Our methodology based on adversarial examples enables institutional traders to assess maximum loss risk effectively . 2 BACKGROUND . Stock Price Forecasting and Market Anomalies . Market agents have long attempted to forecast stock prices . Nonetheless , predicting market behaviour is notoriously difficult for several reasons . If predictive factors become known , they alter the market ’ s behaviour as agents attempt to exploit then . The limit of this behaviour is the efficient market hypothesis ( French , 1970 ) , which states that any information is immediately incorporated in prices , leaving a white noise process . The efficient market hypotheis has generated debate about whether it is possible to systematically outperform the market . See Cornell ( 2020 ) for a recent analysis suggesting that outperformance is possible , and may be linked to outsiders not understanding how such performance is attained . Lastly , markets follow the Red queen effect ( Van Valen , 1973 ) : as parties adapt their prediction capabilities , markets also evolve by becoming more challenging to forecast . The deviations from the efficient market hypothesis are known as market anomalies . They occasionally allow individuals to capitalize off of such discrepancies . See Bass ( 1999 ) for a readable account of a successful application of chaos theory to market prediction . Beyond traditional techniques like arbitrage and standard data analysis , hopes for discovering factors that have not yet been traded away are presently centred on ML techniques , primarily , as the medium by which advances in computing power will drop the costs of research , including , for non-linear predictive factors . Thus , ML is a good fit to tackle the problem stated in the introduction . Indeed , ML models for tasks involving sequential data are now able to learn complex non-linear relationships . Initial work applied these advances to financial time series tasks ( Fischer & Krauss , 2018 ) . Sentiment Analysis in Finance . Sentiment analysis serves as an input signal to trading decisions because it allows one to rapidly digest new information relevant to the market . This requires processing large quantities of text : e.g. , news , financial statements , etc . Previous methods of extracting sentiment and moods were through curated lexicons where every word has a score associated with each sentiment ( Bollen et al. , 2011 ) . Yet , word counting methods poorly reflect semantics since they are unable to factor in features like word order . Bollen et al . ( 2011 ) also received criticism for selecting a small and well specified testing set to achieve good results . On the other hand , training more complex models such as neural networks requires larger datasets . We follow the approach of Araci ( 2019 ) and turn to language models such as BERT ( Devlin et al. , 2019 ) or GTP-2 ( Radford et al. , 2019 ) finetuned on financial sentiment analysis datasets . Such models are able to factor in features that lexicon-based methods could not , achieving a deeper understanding of the text . Time Series Forecasting . The general question of how to predict potential future trajectories from a series of observations is studied in the field of time series forecasting . While traditional modelling approaches like ARIMA ( Box & Jenkins , 1968 ) and exponential smoothing ( Hyndman et al. , 2008 ) have focused on generating forecasts for individual time series , which are typically called local models , more recent techniques based on deep learning enable us to extract patterns from multiple ( potentially related ) time series jointly and capture these patterns in a global model . Popular architectures for time series forecasting include recurrent neural networks ( RNNs ) ( Salinas et al. , 2020 ; Smyl , 2020 ) , convolutional neural networks ( CNNs ) ( Oord et al. , 2016 ; Borovykh et al. , 2017 ; Bai et al. , 2018 ) with 1-dimensional convolutions over time , as well as transformers ( Vaswani et al. , 2017 ; Lim et al. , 2019 ; Li et al. , 2019 ) using attention-based mechanisms . More details about the exact forecasting framework used in this work are established in Section 3.2 . Adversarial Examples . Extensive prior work in adversarial examples is in the vision domain ( Szegedy et al. , 2013 ; Su et al. , 2019 ) . Despite the fundamental advances in our understanding of the robustness of ML these works enabled , the practicality of such work is limited , and the incentives of the adversary to achieve such forms of misclassification is unclear ( Gilmer et al. , 2018 ) . Recent work has focused on more practical domains , such as malware analysis ( Kolosnjaji et al. , 2018 ) or sentiment analysis of movie reviews ( Samanta & Mehta , 2017 ) . Studying the implications of adversarial examples in financial applications is clear : the financial gain will motivate malicious individuals to attack ML models deployed by financial institutions . This begs the question of whether these applications of machine learning to finance will exhibit the same lack of robustness than their counterparts did in the vision domain . In our work , we adapt the common strategy of determining the model ’ s sensitivity to perturbations in the input through an analysis of the model ’ s gradients . In particular , we leverage previous work on RNNs ( Papernot et al. , 2016 ) .
In this paper, the authors studied the problem of adversarial ML in stock price forecasting. They first replicated an industry standard pipeline, which performs a sentiment analysis of Twitter data to forecast trends in stock prices. Then, they show that an adversary can exploit the lack of provenance to indirectly use tweets to manipulate the model’s perceived sentiment about a target company and in turn force the model to forecast price erroneously.
SP:6a909e6ca1ea605f986c0bd229c852d535270af6
On the Robustness of Sentiment Analysis for Stock Price Forecasting
1 INTRODUCTION . Research on the vulnerability of machine learning ( ML ) to adversarial examples ( Biggio et al. , 2013 ; Szegedy et al. , 2013 ) focused , with few exceptions ( Kurakin et al. , 2016 ; Brown et al. , 2017 ) , on adversaries with immediate control over the inputs to an ML model . Yet , ML systems are often applied on large corpora of data collected from sources only partially under the control of adversaries . Recent advances in language modelling ( Devlin et al. , 2019 ; Brown et al. , 2020 ) illustrate this well : they rely on training large architectures on unstructured corpora of text crawled from the Internet . This raises a natural question : when the provenance of train or test inputs to ML systems is ill defined , does this advantage model developers or adversaries ? Here , by provenance we refer to a detailed history of the flow of information into a computer system ( Muniswamy-Reddy et al. ) . We study the example of such an ML system for stock price forecasting . In this application , ML predictions can both serve as inputs to algorithmic trading or to assist human traders . We choose the example of stock price forecasting because it involves several structured applications of ML , including sentiment analysis over a spectrum of public information sources ( e.g. , news , Twitter , etc . ) with little provenance guarantees . There is also a long history of leveraging knowledge inaccessible to all market participants to gain an edge in predicting the prices of securities . Thales used his knowledge of astronomy to corner the market in olive-oil presses and generate a profit . We first reproduce an ML pipeline for stock price prediction , inspired by practices common in the industry . We note that choosing the right time scale is of paramount importance . ML is better suited for low frequency intra-day and weekly trading than high-frequency trading , because the latter requires decision speeds much faster than achievable by ML hardware accelerators . Although there has been prior work on attacking ML for high-frequency trading ( Goldblum et al. , 2020 ) , their experimental setting is 7 orders of magnitude slower than NASDAQ timestamps ( NASDAQ ; 2020 ) , which high-frequency trading firms use . In contrast , ML in low-frequency trading has attracted greater practical interest of the industry , with two major finance data vendors vastly expanding their sentiment data API offerings in the past decade ( Bloomberg , 2017 ; Reuters , 2014 ) . This is to serve the growing demand from institutional and advanced retail market players to use ML models for sentiment analysis at lower frequencies . We adopt this low frequency setting , and collect our data from Twitter and Yahoo finance , which provides 1-minute frequency stock price data . Using these services , we collected tweets related to Tesla and Tesla ’ s stock prices over 3.5 years . We then used FinBERT ( Araci , 2019 ) , a financial sentiment classifier to extract sentiment-based features from every tweet . We describe these methods in more depth in Section 3.1 ; they are general and applicable to any company of interest . We use sentiment features as our input and the change in price as our target to train multiple probabilistic forecasting models . We show that including sentiment features extracted from Twitter can reduce the mean absolute error of a model that only learns from historical stock prices by half . Section 3.2 introduces the probabilistic models used in our work . Predicting stock prices is a known hard task . Even a limited , per trade edge can lead to a large gain when scaled by the number of trades preformed ( Laughlin , 2014 ) . Moreover , typically sentiment analysis is only one of many indicators used in a trade decision . Hence our model only needs to provide a slight non-trivial advantage over random baselines to be effective in practice . We used our forecasts to implement portfolio strategies with positive returns , and measure its performance across other metrics to showcase its advantage . Equipped with this realistic ML pipeline for stock price forecasting , which takes input data from a source with little provenance guarantees ( i.e. , Twitter ) , we set out to study its robustness . Unlike previous settings of adversarial examples like vision , where the realistic incentives for an adversary to change the classification is often unclear ( Gilmer et al. , 2018 ) , in our setting there are clear financial interests at stake . Furthermore , Twitter is already subject to vast disinformation campaigns ( Zannettou et al. , 2019 ) . These make it even more complicated to assess the provenance of data analyzed by ML pipelines . To investigate the robustness of our stock price prediction pipeline , we use adversarial examples to show that our financial sentiment analysis model is brittle in this setting . While attacks against NLP models are not new in research settings , our work demonstrates the practical impacts that attacks on an NLP component ( i.e. , sentiment analysis ) of a system can have on downstream tasks like stock price prediction . We show that an adversary can significantly manipulate the forecasted distribution ‘ s parameters in a targeted direction , while perturbing the sentiment features minimally at test time only . An adversary would determine a parameter and direction , such as increasing variance of forecasted stock prices , and compute a corresponding perturbation . If given control over training data , the adversary ’ s capabilities would only further increase . The contributions of this paper are the following : • We propose a realistic setting for adversarial examples through the task of sentiment analysis for stock price forecasting . We develop a dataset collection pipeline using ticker data and Twitter discussion , for any ticker ( i.e. , company ) . This includes querying Twitter , processing data into a format fit for training , and a suitable sentiment analysis model . • We implement different sentiment-based probabilistic forecasting models that are able to perform better then a naive approach in forecasting stock price changes given Twitter discussion surrounding the company . DeepAR-G , a Gaussian probabilistic forecasting model , outperformed all other models in our experiments . • We subject our pipeline to adversarial manipulation , leveraging information from our model to minimally modify its inputs into adversarial examples , while achieving important changes in our model ’ s output such as shifting distribution parameters of our probability distribution in any direction we wish . We intend to release our code and data should the manuscript be accepted . Beyond the implications of our findings in settings where an adversary is present , we stress that capturing model performance in the worst case setting is important for the domain of finance . These threats are very real : past market anomalies led to the collapse of the Knight Capital Group , and there were legal matters following the suspected manipulation of Tesla stock via Twitter . Therefore , it is important for financial institutions to understand how their ML systems could behave in worst-case settings , lest market anomalies impact these systems in unprecedented ways . Furthermore , unforeseen catastrophic events ( e.g. , a natural disaster or pandemic ) are often hard to model via standard testing procedures be it order generation simulators or backtesting , i.e . simulating trading on replayed past data . Our methodology based on adversarial examples enables institutional traders to assess maximum loss risk effectively . 2 BACKGROUND . Stock Price Forecasting and Market Anomalies . Market agents have long attempted to forecast stock prices . Nonetheless , predicting market behaviour is notoriously difficult for several reasons . If predictive factors become known , they alter the market ’ s behaviour as agents attempt to exploit then . The limit of this behaviour is the efficient market hypothesis ( French , 1970 ) , which states that any information is immediately incorporated in prices , leaving a white noise process . The efficient market hypotheis has generated debate about whether it is possible to systematically outperform the market . See Cornell ( 2020 ) for a recent analysis suggesting that outperformance is possible , and may be linked to outsiders not understanding how such performance is attained . Lastly , markets follow the Red queen effect ( Van Valen , 1973 ) : as parties adapt their prediction capabilities , markets also evolve by becoming more challenging to forecast . The deviations from the efficient market hypothesis are known as market anomalies . They occasionally allow individuals to capitalize off of such discrepancies . See Bass ( 1999 ) for a readable account of a successful application of chaos theory to market prediction . Beyond traditional techniques like arbitrage and standard data analysis , hopes for discovering factors that have not yet been traded away are presently centred on ML techniques , primarily , as the medium by which advances in computing power will drop the costs of research , including , for non-linear predictive factors . Thus , ML is a good fit to tackle the problem stated in the introduction . Indeed , ML models for tasks involving sequential data are now able to learn complex non-linear relationships . Initial work applied these advances to financial time series tasks ( Fischer & Krauss , 2018 ) . Sentiment Analysis in Finance . Sentiment analysis serves as an input signal to trading decisions because it allows one to rapidly digest new information relevant to the market . This requires processing large quantities of text : e.g. , news , financial statements , etc . Previous methods of extracting sentiment and moods were through curated lexicons where every word has a score associated with each sentiment ( Bollen et al. , 2011 ) . Yet , word counting methods poorly reflect semantics since they are unable to factor in features like word order . Bollen et al . ( 2011 ) also received criticism for selecting a small and well specified testing set to achieve good results . On the other hand , training more complex models such as neural networks requires larger datasets . We follow the approach of Araci ( 2019 ) and turn to language models such as BERT ( Devlin et al. , 2019 ) or GTP-2 ( Radford et al. , 2019 ) finetuned on financial sentiment analysis datasets . Such models are able to factor in features that lexicon-based methods could not , achieving a deeper understanding of the text . Time Series Forecasting . The general question of how to predict potential future trajectories from a series of observations is studied in the field of time series forecasting . While traditional modelling approaches like ARIMA ( Box & Jenkins , 1968 ) and exponential smoothing ( Hyndman et al. , 2008 ) have focused on generating forecasts for individual time series , which are typically called local models , more recent techniques based on deep learning enable us to extract patterns from multiple ( potentially related ) time series jointly and capture these patterns in a global model . Popular architectures for time series forecasting include recurrent neural networks ( RNNs ) ( Salinas et al. , 2020 ; Smyl , 2020 ) , convolutional neural networks ( CNNs ) ( Oord et al. , 2016 ; Borovykh et al. , 2017 ; Bai et al. , 2018 ) with 1-dimensional convolutions over time , as well as transformers ( Vaswani et al. , 2017 ; Lim et al. , 2019 ; Li et al. , 2019 ) using attention-based mechanisms . More details about the exact forecasting framework used in this work are established in Section 3.2 . Adversarial Examples . Extensive prior work in adversarial examples is in the vision domain ( Szegedy et al. , 2013 ; Su et al. , 2019 ) . Despite the fundamental advances in our understanding of the robustness of ML these works enabled , the practicality of such work is limited , and the incentives of the adversary to achieve such forms of misclassification is unclear ( Gilmer et al. , 2018 ) . Recent work has focused on more practical domains , such as malware analysis ( Kolosnjaji et al. , 2018 ) or sentiment analysis of movie reviews ( Samanta & Mehta , 2017 ) . Studying the implications of adversarial examples in financial applications is clear : the financial gain will motivate malicious individuals to attack ML models deployed by financial institutions . This begs the question of whether these applications of machine learning to finance will exhibit the same lack of robustness than their counterparts did in the vision domain . In our work , we adapt the common strategy of determining the model ’ s sensitivity to perturbations in the input through an analysis of the model ’ s gradients . In particular , we leverage previous work on RNNs ( Papernot et al. , 2016 ) .
The paper studies the impact of adversarial attacks on a ML based system for forecasting stock prices. The authors leverage Twitter data in order to enhance stock price prediction. Then, by determining the sensitivity of the model when perturbing the inputs. Then, small changes are applied to the inputs and output is observed. The authors experimented with the Tesla stock price.
SP:6a909e6ca1ea605f986c0bd229c852d535270af6
Multi-Head Attention: Collaborate Instead of Concatenate
1 INTRODUCTION . Since the invention of attention ( Bahdanau et al. , 2014 ) and its popularization in the transformer architecture ( Vaswani et al. , 2017 ) , multi-head attention ( MHA ) has become the de facto architecture for natural language understanding tasks ( Devlin et al. , 2019 ) and neural machine translation . Attention mechanisms have also gained traction in computer vision following the work of Ramachandran et al . ( 2019 ) and Bello et al . ( 2019 ) . Nevertheless , despite their wide adoption , we currently lack solid theoretical understanding of how transformers operate . In fact , many of their modules and hyperparameters are derived from empirical evidences that are possibly circumstantial . The uncertainty is amplified in multi-head attention , where both the roles and interactions between heads are still poorly understood . Empirically , it is well known that using multiple heads can improve model accuracy . However , not all heads are equally informative , and it has been shown that certain heads can be pruned without impacting model performance . For instance , Voita et al . ( 2019 ) present a method to quantify head utility and prune redundant members . Michel et al . ( 2019 ) go further to question the utility of multiple heads by testing the effect of heavy pruning in several settings . On the other hand , Cordonnier et al . ( 2020 ) prove that multiple heads are needed for self-attention to perform convolution , specifically requiring one head per pixel in the filter ’ s receptive field . Beyond the number of heads , finding the adequate head dimension is also an open question . Bhojanapalli et al . ( 2020 ) finds that the division of the key/query projection between heads gives rise to a low-rank bottleneck for each attention head expressivity that can be fixed by increasing the head sizes . In contrast , our approach increases heads expressivity by leveraging the low-rankness accross heads to share common query/key dimensions . This work aims to better detect and quantify head redundancy by asking whether independent heads learn overlapping or distinct concepts . This relates to the work on CNN compression that factorizes common filters in a trained convolutional network ( Kim et al. , 2016 ) using Tucker decomposition . In attention models , we discover that some key/query projected dimensions are redundant , as trained 1https : //github.com/ ... concatenated heads tend to compute their attention patterns on common features . Our finding implies that MHA can be re-parametrized with better weight sharing for these common projections and a lower number of parameters . This differs from concurrent work ( Shazeer et al. , 2020 ) that orchestrate collaboration between heads on top of the dot product attention scores . Contribution 1 : Introducing the collaborative multi-head attention layer . Section 3 describes a collaborative attention layer that allows heads to learn shared key and query features . The proposed re-parametrization significantly decreases the number of parameters of the attention layer without sacrificing performance . Our Neural Machine Translation experiments in Section 4 show that the number of FLOPS and parameters to compute the attention scores can be divided by 4 without affecting the BLEU score on the WMT14 English-to-German task . Contribution 2 : Re-parametrizing pre-trained models into a collaborative form renders them more efficient . Pre-training large language models has been central to the latest NLP developments . But pre-training transformers from scratch remains daunting for its computational cost even when using more efficient training tasks such as ( Clark et al. , 2020 ) . Interestingly , our changes to the MHA layers can be applied post-hoc on pre-trained transformers , as a drop-in replacement of classic attention layers . To achieve this , we compute the weights of the re-parametrized layer using canonical tensor decomposition of the query and key matrices in the original layer . Our experiments in Section 4 show that the key/query dimensions can be divided by 3 without any degradation in performance . As a side contribution , we identify a discrepancy between the theory and some implementations of attention layers and show that by correctly modeling the biases of key and query layers , we can clearly differentiate between context and content-based attention . 2 MULTI-HEAD ATTENTION . We first review standard multi-head attention introduced by Vaswani et al . ( 2017 ) . 2.1 ATTENTION . Let X ∈ RT×Din and Y ∈ RT ′×Din be two input matrices consisting of respectively T and T ′ tokens of Din dimensions each . An attention layer maps each of the T query token from Din to Dout dimensions as follows : Attention ( Q , K , V ) = softmax ( QK > √ dk ) V , with Q = XWQ , K = Y WK , V = Y WV ( 1 ) The layer is parametrized by a query matrix WQ ∈ RDin×Dk , a key matrix WK ∈ RDin×Dk and a value matrix WV ∈ RDin×Dout . Using attention on the same sequence ( i.e . X = Y ) is known as self-attention and is the basic building block of the transformer architecture . 2.2 CONTENT VS . CONTEXT . Some re-implementations of the original transformer architecture2 use biases in the linear layers . This differs from the attention operator defined in eq . ( 1 ) where the biases bQ and bK ∈ RDk are ommited . Key and query projections are computed as K = XWK + 1T×1bK and Q = Y WQ + 1T×1bQ , respectively , where 1a×b is an all one matrix of dimension a × b . The exact computation of the ( unscaled ) attention scores can be decomposed as follows : QK > = ( XWQ + 1T×1b > Q ) ( Y WK + 1T×1b > K ) > ( 2 ) = XWQW > K Y > ︸ ︷︷ ︸ context +1T×1b > QW > K Y > ︸ ︷︷ ︸ content +XWQbK11×T + 1T×T b > QbK ( 3 ) As the last two terms of eq . ( 3 ) have a constant contribution over all entries of the same row , they do not contribute to the computed attention probabilities ( softmax is shift invariant and softmax ( x + c ) = softmax ( x ) , ∀c ) . On the other hand , the first two terms have a clear meaning : XWQW > K Y > 2For instance : the BERT orignal implementation , its HuggingFace re-implementation and FairSeq encoderdecoder transformer . considers the relation between keys and query pairs , whereas 1T×1b > QW > K Y > computes attention solely based on key content . The above findings suggest that the bias bK of the key layer can be always be disabled without any consequence . Moreover , the query biases bQ play an additional role : they allow for attention scores that are content-based , rather than solely depending on key-query interactions . This could provide an explanation for the recent success of the Dense-SYNTHESIZER ( Tay et al. , 2020 ) , a method that ignores context and computes attention scores solely as a function of individual tokens . That is , perhaps context is not always crucial for attention scores , and content can suffice . 2.3 MULTI-HEAD ATTENTION . Traditionally , the attention mechanism is replicated by concatenation to obtain multi-head attention defined for Nh heads as : MultiHead ( X , Y ) = concat i∈ [ Nh ] [ H ( i ) ] WO ( 4 ) H ( i ) = Attention ( XW ( i ) Q , Y W ( i ) K , Y W ( i ) V ) , ( 5 ) where distinct parameter matrices W ( i ) Q , W ( i ) K ∈ RDin×dk and W ( i ) V ∈ RDin×dout are learned for each head i ∈ [ Nh ] and the extra parameter matrix WO ∈ RNhdout×Dout projects the concatenation of the Nh head outputs ( each in Rdout ) to the output space RDout . In the multi-head setting , we call dk the dimension of each head and Dk = Nhdk the total dimension of the query/key space . 3 IMPROVING THE MULTI-HEAD MECHANISM . Head concatenation is a simple and remarkably practical setup that gives empirical improvements . However , we show that another path could have been taken instead of concatenation . As the multiple heads are inherently solving similar tasks , they can collaborate instead of being independent . 3.1 HOW MUCH DO HEADS HAVE IN COMMON ? . We hypothesize that some heads might attend on similar features in the input space , for example computing high attention on the verb of a sentence or extracting some dimensions of the positional encoding . To verify this hypothesis , it does not suffice to look at the similarity between query ( or key ) matrices { W ( i ) Q } i∈ [ Nh ] of different heads . To illustrate this issue , consider the case where two heads are computing the same key/query representations up to a unitary matrix R ∈ Rdk×dk such that W ( 2 ) Q = W ( 1 ) Q R and W ( 2 ) K = W ( 1 ) K R. Even though the two heads are computing identical attention scores , i.e . W ( 1 ) Q RR > W ( 1 ) > K = W ( 1 ) Q W ( 1 ) > K , they can have orthogonal column-spaces and the concatenation [ W ( 1 ) Q , W ( 2 ) Q ] ∈ RDin×2dk can be full rank . To disregard artificial differences due to common rotations or scaling of the key/query spaces , we study the similarity of the product W ( i ) Q W ( i ) > K ∈ RDin×Din across heads . Figure 1 shows the captured energy by the principal components of the key , query matrices and their product . It can be seen on the left that single head key/query matrices W ( i ) Q W ( i ) > K are not low rank on average . However , as seen on the right , even if parameter matrices taken separately are not low rank , their concatenation is indeed low rank . This means that heads , though acting independently , learn to focus on the same subspaces . The phenomenon is quite pronounced : one third of the dimensions suffices to capture almost all the energy of WQW > K , which suggests that there is inefficiency in the way multi-head attention currently operate . 3.2 COLLABORATIVE MULTI-HEAD ATTENTION . Following the observation that heads ’ key/query projections learn redundant projections , we propose to learn key/query projections for all heads at once and to let each head use a re-weighting of these projections . Our collaborative head attention is defined as follows : CollabHead ( X , Y ) = concat i∈ [ Nh ] [ H ( i ) ] WO ( 6 ) H ( i ) = Attention ( XW̃Q diag ( mi ) , Y W̃K , Y W ( i ) V ) . ( 7 ) The main difference with standard multi-head attention defined in eq . ( 5 ) is that we do not duplicate the key and query matrices for each head . Instead , each head learns a mixing vector mi ∈ RD̃k that defines a custom dot product over the D̃k projected dimensions of the shared matrices W̃Q and W̃K of dimension Din × D̃k . This approach leads to : ( i ) adaptive head expressiveness , with heads being able to use more or fewer dimensions according to attention pattern complexity ; ( ii ) parameter efficient representation , as learned projections are shared between heads , hence stored and learned only once . It is instructive to observe how standard multi-head attention ( where heads are simply concatenated ) can be seen as a special case of our collaborative framework ( with D̃k = Nhdk ) . The left of Figure 2 displays the standard attention computed between xn and ym input vectors with the mixing matrix M : = concat i∈ [ Nh ] [ mi ] ∈ RNh×D̃k , ( 8 ) laying out the mixing vectors mi as rows . In the concatenated MHA , the mixing vector mi for the i-th head is a vector with ones aligned with the dk dimensions allocated to the i-th head among the Dk = Nhdk total dimensions . Some alternative collaborative schema can be seen on the right side of Figure 2 . By learning the mixing vectors { mi } i∈ [ Nh ] instead of fixing them to this “ blocks-of-1 ” structure , we increase the expressive power of each head for a negligible increase in the number of parameters . The size dk of each head , arbitrarily set to 64 in most implementations , is now adaptive and the heads can attend to a smaller or bigger subspace if needed .
This paper analyzes the multi-head attention in transformers and suggests to use collaboration instead of concatenation of multiple heads. Empirical results on WMT’16 English-German demonstrates that the proposed approach reduces the of parameters without sacrificing performance. Further experiments on pre-trained BERT models also demonstrate its efficiency. Overall, the paper is well motivated and provides a deep analysis of redundancy of the multi-head attention.
SP:ee20fb0517e11ddb87a713434d3bd8f29812a521
Multi-Head Attention: Collaborate Instead of Concatenate
1 INTRODUCTION . Since the invention of attention ( Bahdanau et al. , 2014 ) and its popularization in the transformer architecture ( Vaswani et al. , 2017 ) , multi-head attention ( MHA ) has become the de facto architecture for natural language understanding tasks ( Devlin et al. , 2019 ) and neural machine translation . Attention mechanisms have also gained traction in computer vision following the work of Ramachandran et al . ( 2019 ) and Bello et al . ( 2019 ) . Nevertheless , despite their wide adoption , we currently lack solid theoretical understanding of how transformers operate . In fact , many of their modules and hyperparameters are derived from empirical evidences that are possibly circumstantial . The uncertainty is amplified in multi-head attention , where both the roles and interactions between heads are still poorly understood . Empirically , it is well known that using multiple heads can improve model accuracy . However , not all heads are equally informative , and it has been shown that certain heads can be pruned without impacting model performance . For instance , Voita et al . ( 2019 ) present a method to quantify head utility and prune redundant members . Michel et al . ( 2019 ) go further to question the utility of multiple heads by testing the effect of heavy pruning in several settings . On the other hand , Cordonnier et al . ( 2020 ) prove that multiple heads are needed for self-attention to perform convolution , specifically requiring one head per pixel in the filter ’ s receptive field . Beyond the number of heads , finding the adequate head dimension is also an open question . Bhojanapalli et al . ( 2020 ) finds that the division of the key/query projection between heads gives rise to a low-rank bottleneck for each attention head expressivity that can be fixed by increasing the head sizes . In contrast , our approach increases heads expressivity by leveraging the low-rankness accross heads to share common query/key dimensions . This work aims to better detect and quantify head redundancy by asking whether independent heads learn overlapping or distinct concepts . This relates to the work on CNN compression that factorizes common filters in a trained convolutional network ( Kim et al. , 2016 ) using Tucker decomposition . In attention models , we discover that some key/query projected dimensions are redundant , as trained 1https : //github.com/ ... concatenated heads tend to compute their attention patterns on common features . Our finding implies that MHA can be re-parametrized with better weight sharing for these common projections and a lower number of parameters . This differs from concurrent work ( Shazeer et al. , 2020 ) that orchestrate collaboration between heads on top of the dot product attention scores . Contribution 1 : Introducing the collaborative multi-head attention layer . Section 3 describes a collaborative attention layer that allows heads to learn shared key and query features . The proposed re-parametrization significantly decreases the number of parameters of the attention layer without sacrificing performance . Our Neural Machine Translation experiments in Section 4 show that the number of FLOPS and parameters to compute the attention scores can be divided by 4 without affecting the BLEU score on the WMT14 English-to-German task . Contribution 2 : Re-parametrizing pre-trained models into a collaborative form renders them more efficient . Pre-training large language models has been central to the latest NLP developments . But pre-training transformers from scratch remains daunting for its computational cost even when using more efficient training tasks such as ( Clark et al. , 2020 ) . Interestingly , our changes to the MHA layers can be applied post-hoc on pre-trained transformers , as a drop-in replacement of classic attention layers . To achieve this , we compute the weights of the re-parametrized layer using canonical tensor decomposition of the query and key matrices in the original layer . Our experiments in Section 4 show that the key/query dimensions can be divided by 3 without any degradation in performance . As a side contribution , we identify a discrepancy between the theory and some implementations of attention layers and show that by correctly modeling the biases of key and query layers , we can clearly differentiate between context and content-based attention . 2 MULTI-HEAD ATTENTION . We first review standard multi-head attention introduced by Vaswani et al . ( 2017 ) . 2.1 ATTENTION . Let X ∈ RT×Din and Y ∈ RT ′×Din be two input matrices consisting of respectively T and T ′ tokens of Din dimensions each . An attention layer maps each of the T query token from Din to Dout dimensions as follows : Attention ( Q , K , V ) = softmax ( QK > √ dk ) V , with Q = XWQ , K = Y WK , V = Y WV ( 1 ) The layer is parametrized by a query matrix WQ ∈ RDin×Dk , a key matrix WK ∈ RDin×Dk and a value matrix WV ∈ RDin×Dout . Using attention on the same sequence ( i.e . X = Y ) is known as self-attention and is the basic building block of the transformer architecture . 2.2 CONTENT VS . CONTEXT . Some re-implementations of the original transformer architecture2 use biases in the linear layers . This differs from the attention operator defined in eq . ( 1 ) where the biases bQ and bK ∈ RDk are ommited . Key and query projections are computed as K = XWK + 1T×1bK and Q = Y WQ + 1T×1bQ , respectively , where 1a×b is an all one matrix of dimension a × b . The exact computation of the ( unscaled ) attention scores can be decomposed as follows : QK > = ( XWQ + 1T×1b > Q ) ( Y WK + 1T×1b > K ) > ( 2 ) = XWQW > K Y > ︸ ︷︷ ︸ context +1T×1b > QW > K Y > ︸ ︷︷ ︸ content +XWQbK11×T + 1T×T b > QbK ( 3 ) As the last two terms of eq . ( 3 ) have a constant contribution over all entries of the same row , they do not contribute to the computed attention probabilities ( softmax is shift invariant and softmax ( x + c ) = softmax ( x ) , ∀c ) . On the other hand , the first two terms have a clear meaning : XWQW > K Y > 2For instance : the BERT orignal implementation , its HuggingFace re-implementation and FairSeq encoderdecoder transformer . considers the relation between keys and query pairs , whereas 1T×1b > QW > K Y > computes attention solely based on key content . The above findings suggest that the bias bK of the key layer can be always be disabled without any consequence . Moreover , the query biases bQ play an additional role : they allow for attention scores that are content-based , rather than solely depending on key-query interactions . This could provide an explanation for the recent success of the Dense-SYNTHESIZER ( Tay et al. , 2020 ) , a method that ignores context and computes attention scores solely as a function of individual tokens . That is , perhaps context is not always crucial for attention scores , and content can suffice . 2.3 MULTI-HEAD ATTENTION . Traditionally , the attention mechanism is replicated by concatenation to obtain multi-head attention defined for Nh heads as : MultiHead ( X , Y ) = concat i∈ [ Nh ] [ H ( i ) ] WO ( 4 ) H ( i ) = Attention ( XW ( i ) Q , Y W ( i ) K , Y W ( i ) V ) , ( 5 ) where distinct parameter matrices W ( i ) Q , W ( i ) K ∈ RDin×dk and W ( i ) V ∈ RDin×dout are learned for each head i ∈ [ Nh ] and the extra parameter matrix WO ∈ RNhdout×Dout projects the concatenation of the Nh head outputs ( each in Rdout ) to the output space RDout . In the multi-head setting , we call dk the dimension of each head and Dk = Nhdk the total dimension of the query/key space . 3 IMPROVING THE MULTI-HEAD MECHANISM . Head concatenation is a simple and remarkably practical setup that gives empirical improvements . However , we show that another path could have been taken instead of concatenation . As the multiple heads are inherently solving similar tasks , they can collaborate instead of being independent . 3.1 HOW MUCH DO HEADS HAVE IN COMMON ? . We hypothesize that some heads might attend on similar features in the input space , for example computing high attention on the verb of a sentence or extracting some dimensions of the positional encoding . To verify this hypothesis , it does not suffice to look at the similarity between query ( or key ) matrices { W ( i ) Q } i∈ [ Nh ] of different heads . To illustrate this issue , consider the case where two heads are computing the same key/query representations up to a unitary matrix R ∈ Rdk×dk such that W ( 2 ) Q = W ( 1 ) Q R and W ( 2 ) K = W ( 1 ) K R. Even though the two heads are computing identical attention scores , i.e . W ( 1 ) Q RR > W ( 1 ) > K = W ( 1 ) Q W ( 1 ) > K , they can have orthogonal column-spaces and the concatenation [ W ( 1 ) Q , W ( 2 ) Q ] ∈ RDin×2dk can be full rank . To disregard artificial differences due to common rotations or scaling of the key/query spaces , we study the similarity of the product W ( i ) Q W ( i ) > K ∈ RDin×Din across heads . Figure 1 shows the captured energy by the principal components of the key , query matrices and their product . It can be seen on the left that single head key/query matrices W ( i ) Q W ( i ) > K are not low rank on average . However , as seen on the right , even if parameter matrices taken separately are not low rank , their concatenation is indeed low rank . This means that heads , though acting independently , learn to focus on the same subspaces . The phenomenon is quite pronounced : one third of the dimensions suffices to capture almost all the energy of WQW > K , which suggests that there is inefficiency in the way multi-head attention currently operate . 3.2 COLLABORATIVE MULTI-HEAD ATTENTION . Following the observation that heads ’ key/query projections learn redundant projections , we propose to learn key/query projections for all heads at once and to let each head use a re-weighting of these projections . Our collaborative head attention is defined as follows : CollabHead ( X , Y ) = concat i∈ [ Nh ] [ H ( i ) ] WO ( 6 ) H ( i ) = Attention ( XW̃Q diag ( mi ) , Y W̃K , Y W ( i ) V ) . ( 7 ) The main difference with standard multi-head attention defined in eq . ( 5 ) is that we do not duplicate the key and query matrices for each head . Instead , each head learns a mixing vector mi ∈ RD̃k that defines a custom dot product over the D̃k projected dimensions of the shared matrices W̃Q and W̃K of dimension Din × D̃k . This approach leads to : ( i ) adaptive head expressiveness , with heads being able to use more or fewer dimensions according to attention pattern complexity ; ( ii ) parameter efficient representation , as learned projections are shared between heads , hence stored and learned only once . It is instructive to observe how standard multi-head attention ( where heads are simply concatenated ) can be seen as a special case of our collaborative framework ( with D̃k = Nhdk ) . The left of Figure 2 displays the standard attention computed between xn and ym input vectors with the mixing matrix M : = concat i∈ [ Nh ] [ mi ] ∈ RNh×D̃k , ( 8 ) laying out the mixing vectors mi as rows . In the concatenated MHA , the mixing vector mi for the i-th head is a vector with ones aligned with the dk dimensions allocated to the i-th head among the Dk = Nhdk total dimensions . Some alternative collaborative schema can be seen on the right side of Figure 2 . By learning the mixing vectors { mi } i∈ [ Nh ] instead of fixing them to this “ blocks-of-1 ” structure , we increase the expressive power of each head for a negligible increase in the number of parameters . The size dk of each head , arbitrarily set to 64 in most implementations , is now adaptive and the heads can attend to a smaller or bigger subspace if needed .
The paper investigates the over-parameterization of attention heads in Transformer’s multi-head attention. The authors show that query-key projections are redundant because trained concatenated heads tend to compute their attention patterns on common features. They propose a reparameterization of multi-head attention allowing the parameters of queries and keys to be shared between heads: this is called “collaborative attention”. This attention can be applied either instead of the standard attention during training, or as a drop-in replacement for an already trained model. To use as a drop-in replacement, the method requires to use tensor decomposition and subsequent model fine-tuning.
SP:ee20fb0517e11ddb87a713434d3bd8f29812a521
Truthful Self-Play
1 INTRODUCTION . Evolving culture prevents deep neural networks from falling into bad local optima ( Bengio , 2012 ) . For example , self-play ( Samuel , 1967 ; Tesauro , 1995 ) has not only demonstrated the ability to abstract high-dimensional state spaces as typified by AlphaGo ( Silver et al. , 2017 ) , but also improved exploration coverage in partially observable environments and communication ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) to exchange their internal representations , such as explored observation and hidden state in RNNs . Evolutionary learning is expected to be a general framework for creating superhuman AIs as such learning can generate a high-level abstract representation without any bias in supervision . However , when applying evolutionary learning to a partially observable environment with noncooperative agents , improper bias is injected into the state representation . This bias originates from the environment . A partially observable environment with non-cooperative agents induces actions that disable an agent from honestly sharing the correct internal state resulting in the agent taking actions such as concealing information and deceiving other agents at equilibrium ( Singh et al. , 2019 ) . The problem arises because the agent can not fully observe the state of the environment , and thus , it does not have sufficient knowledge to verify the information provided by other agents . Furthermore , neural networks are vulnerable to adversarial examples ( Szegedy et al. , 2014 ) and are likely to induce erroneous behavior with small perturbations . Many discriminative models for information accuracy are available ; these include GANs ( Goodfellow et al. , 2014 ; Radford et al. , 2016 ) and curriculum learning ( Lowe et al. , 2020 ) . However , these models assume that accurate samples can be obtained by supervision . Because of this assumption , is it impossible to apply these models to a partially observable environment , where the distribution is not stable . We generalize self-play to non-cooperative partially observable environments via mechanism design ( Myerson , 1983 ; Miller et al. , 2005 ) , which is also known as reverse game theory . The key idea is to add imaginary rewards by using the peer prediction method ( Miller et al. , 2005 ) , that is , a mechanism for evaluating the validity of information exchanged between agents in a decentralized environment , which is calculated based on social influence on the signals . We formulate the non-cooperative partially observable environment as an extention of the pertially observable stochastic games ( POSG ) ( Hansen et al. , 2004 ) ; introduce truthfulness ( Vickrey , 1961 ) , which is an indicator of the validity of state representation . We show that the imaginary reward enables us to reflect the bias of state representation on the gradient without oracles . As the first contribution , we propose truthful self-play ( TSP ) and analytically demonstrate convergence to the global optimum ( Section 4 ) . We propose the imaginary reward on the basis of the peer prediction method ( Miller et al. , 2005 ) and apply it to self-play . The mechanism affects the gradient of the local optima , but not the global optima . The trick is to use the actions taken by the agents as feedback to verify the received signal from the every other agent , instead of the true state , input , and intent , which the agents can not fully observe . TSP only requires a modification of the baseline function for self-play ; it drastically improves the convergence to the global optimum in Comm-POSG . As the second contribution , based on the results of numerical experiments , we report that the TSP achieved state-of-the-art performance for various multi-agent tasks made of up to 20 agents ( Section 5 ) . Using predator prey ( Barrett et al. , 2011 ) , traffic junction ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) , and StarCraft Synnaeve et al . ( 2016 ) environments , which are typically used in Comm-POSG research , we compared the performances of TSP with the current neural nets , including the state-ofthe-art method , with LSTM , CommNet ( Sukhbaatar et al. , 2016 ) , and IC3Net ( Singh et al. , 2019 ) . We report that the model with IC3Net optimized by TSP has the best performance . This work is the first attempt to apply mechanism design to evolutionary learning . TSP is a general optimization algorithm whose convergence is theoretically guaranteed for arbitrary policies and environments . Furthermore , since no supervision is required , TSP has a wide range of applications to not only game AIs ( Silver et al. , 2017 ) , but also the robots ( Jaderberg et al. , 2018 ) , chatbots ( Gupta et al. , 2019 ; Chevalier et al. , 2019 ) , and autonomous cars ( Tang , 2019 ) that are employed in multiagent tasks . Notation : Vectors are columns . Let JnK : = { 1 , . . . , n } . R is a set of real numbers . i is the imaginary unit . Reu and Imu are a real and an imaginary part of complex number u , respectively . n-tuple are written as boldface of the original variables a : = 〈a1 , . . . , an〉 , and a−i is a ( n− 1 ) -tuple obtained by removing the i-th entry from a . Let 1 : = ( 1 , . . . , 1 ) T. Matrices are shown in uppercase letters L : = ( ` ij ) . E is the unit matrix . The set of probability distributions based on the support X is described as P ( X ) . 2 RELATED WORK . Neural communication has gained attention in the field of multiagent reinforcement learning ( MARL ) for both discrete ( Foerster et al. , 2016 ) and continuous ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) signals . Those networks are trained via self-play to exchange the internal state of the environment stored in the working memory of recurrent neural networks ( RNNs ) to learn the right policy in partially observable environments . The term self-play was coined by the game AI community in the latter half of the century . Samuel ( Samuel , 1967 ) introduced self-play as a framework for sharing a state-action value among two opposing agents to efficiently search the state space at Checkers . TD-Gammon ( Tesauro , 1995 ) introduced self-play as a framework to learn TD ( λ ) ( Sutton & Barto , 1998 ) and achieve professionalgrade levels in backgammon . AlphaGo ( Silver et al. , 2017 ) defeated the Go champion by combining supervised learning with professional game records and self-play . AlphaZero ( Silver et al. , 2018 ) successfully learnt beyond its own performance entirely based on self-play . All these studies explain that eliminating the bias of human knowledge in supervision is the advantage of self-play . Self-play is also known as evolutionary learning ( Bengio , 2012 ) in the deep learning community mainly as an approach to emerging representations without supervision ( Bansal et al. , 2018 ; Balduzzi et al. , 2019 ) . Bansal et al . ( 2018 ) show that competitive environments contribute to emerging diversity and complexity . Rich generative models such as GANs ( Goodfellow et al. , 2014 ; Radford et al. , 2016 ) are frameworks for acquiring an environmental model by employing competitive settings . RNNs such as world models ( Ha & Schmidhuber , 2018 ; Eslami et al. , 2018 ) are capable of more comprehensive ranges of exploration in partially observable environments and generation of symbols and languages ( Bengio , 2017 ; Gupta et al. , 2019 ; Chevalier et al. , 2019 ) . The difference between evolutionary learning and supervised learning is the absence of human knowledge and oracles . Several works have formalized those in which the agents exchange environmental information as a formal class of the games such as Dec-POMDP-Com ( Goldman & Zilberstein , 2003 ) and COMMTDP ( Pynadath & Tambe , 2002 ) , and several frameworks are proposed to aim to solve the problems . However , the limitation of the frameworks is that they assume a common reward . As there are yet no formal definition of non-cooperative communication game , we formalize such a game to Comm-POSG as a superset of POSGs ( Hansen et al. , 2004 ) , a more general class of multi-agent games including the cases of non-cooperativity ( Hansen et al. , 2004 ) . To the best of our knowledge , there are no studies that have introduced truthful mechanisms into the field of MARL , but it may be possible to introduce it by using agents that can learn flexibly , such as neural networks . A typical truthful mechanism is the VCG mechanism ( Vickrey , 1961 ) , which is a generalization of the pivot method used in auction theory , but whereas the subject of the report that must satisfy truthfulness must be a valuation ( or a value function if interpreted from a RL perspective ) . In this study , the scope of application is different because the belief states of the environment are subject to reporting . Therefore , we introduce instead a peer prediction method ( Miller et al. , 2005 ) that guarantees truthfulness with respect to reporting beliefs about arbitrary probability distributions using proper scoring rules ( Gneiting & Raftery , 2007 ) . 3 PROBLEM DEFINITION . 3.1 COMM-POSG . A communicative partially-observable stochastic game ( Comm-POSG ) is a class of non-cooperative Bayesian games in which every agent does not fully observe the environment but interacts each other . We define Comm-POSG as an extension of POSG ( Hansen et al. , 2004 ) with a message protocol . Definition 3.1 ( Hansen et al. , 2004 ) POSG 〈n , T , S , A , X , T , P , R〉 is a class for multi-agent decision making under uncertainty in which the state evolves over time 1 ≤ t ≤ T , where • n is the number of agents , • T is a horizon i.e. , the episode length , • S is a set of discrete/continuous state st ∈ S with an initial probabilistic distribution p ( s0 ) , • A is a set of discrete/continuous action ati ∈ A , • X is a set of discrete/continuous observation xti ∈ X , • T ∈ P ( S ×A× S ) is state transition probability , • P ∈ P ( S × Xn ) is an observation probability , and • R : S ×An → Rn is a reward function that outputs an n-dimensional vector . In Comm-POSGs , every agent further follows a message protocol Zn×n , where Z is the discrete/continuous signal space . The complete information exchanged among the agent in time is Zt , where Zt : = ( ztij ) i , j∈JnK ∈ Zn×n is a signal matrix in which ( i , j ) -th entry ztij represents a signal from Agent i to Agent j at t. The i-th diagonal entry of Zt , hti : = ztii represents the pre-state , an internal state of i-th agent before receiving the singals from the others . A game in Comm-POSG is denoted as G : = 〈n , T , S , A , X , T , P , R , Z〉 . The objective function of Comm-POSG is social welfare ( Arrow , 1963 ) defined by the following , J : = n∑ i=1 V πi ; V πi : = Eπi [ T∑ t=1 γt−1rti ] , ( 1 ) where γ ∈ [ 0 , 1 ] is discount rate , rti is reward πi is a stochastic policy , and V πi is the value function . In extensive-form games including Comm-POSG , in addition to the information in the environment , the information of other agents can not be observed . In the optimization problem under these assumptions , a policy converges to a solution called the Bayesian Nash equilibrium ( BNE ) ( Fudenberg , 1993 ) . We denote the social welfare at the BNE is J∗ , and the global maximum Ĵ . In general , J∗ 6= Ĵ holds , which is closely related to the information asymmetry .
This work presents an auxiliary loss that promotes truthfulness in non-cooperative multi-agent games with communication channels. The truthfulness is promoted through prediction rewards, which capture how well each agent can model other agents' policies via observing their messages. For this mechanism to work, it assumes that each agent has access to other policies, and such an assumption can be satisfied under the self-play / centralized-learning decentralized-execution / shared-weights setup. Having such access to the policy weights, an agent can observe how consistent was their action with their broadcasted message which is a function over their hidden state. Thus by promoting consistency between their actions and messages, truthfulness is achieved. This paper provides theoretical justification of the proposed mechanism and introduces ideas from mechanism design literature in multi-agent reinforcement learning under a non-cooperative setup (not sharing rewards).
SP:631bfb07c83d98b09d95e8ad06969f8ecbe936e9
Truthful Self-Play
1 INTRODUCTION . Evolving culture prevents deep neural networks from falling into bad local optima ( Bengio , 2012 ) . For example , self-play ( Samuel , 1967 ; Tesauro , 1995 ) has not only demonstrated the ability to abstract high-dimensional state spaces as typified by AlphaGo ( Silver et al. , 2017 ) , but also improved exploration coverage in partially observable environments and communication ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) to exchange their internal representations , such as explored observation and hidden state in RNNs . Evolutionary learning is expected to be a general framework for creating superhuman AIs as such learning can generate a high-level abstract representation without any bias in supervision . However , when applying evolutionary learning to a partially observable environment with noncooperative agents , improper bias is injected into the state representation . This bias originates from the environment . A partially observable environment with non-cooperative agents induces actions that disable an agent from honestly sharing the correct internal state resulting in the agent taking actions such as concealing information and deceiving other agents at equilibrium ( Singh et al. , 2019 ) . The problem arises because the agent can not fully observe the state of the environment , and thus , it does not have sufficient knowledge to verify the information provided by other agents . Furthermore , neural networks are vulnerable to adversarial examples ( Szegedy et al. , 2014 ) and are likely to induce erroneous behavior with small perturbations . Many discriminative models for information accuracy are available ; these include GANs ( Goodfellow et al. , 2014 ; Radford et al. , 2016 ) and curriculum learning ( Lowe et al. , 2020 ) . However , these models assume that accurate samples can be obtained by supervision . Because of this assumption , is it impossible to apply these models to a partially observable environment , where the distribution is not stable . We generalize self-play to non-cooperative partially observable environments via mechanism design ( Myerson , 1983 ; Miller et al. , 2005 ) , which is also known as reverse game theory . The key idea is to add imaginary rewards by using the peer prediction method ( Miller et al. , 2005 ) , that is , a mechanism for evaluating the validity of information exchanged between agents in a decentralized environment , which is calculated based on social influence on the signals . We formulate the non-cooperative partially observable environment as an extention of the pertially observable stochastic games ( POSG ) ( Hansen et al. , 2004 ) ; introduce truthfulness ( Vickrey , 1961 ) , which is an indicator of the validity of state representation . We show that the imaginary reward enables us to reflect the bias of state representation on the gradient without oracles . As the first contribution , we propose truthful self-play ( TSP ) and analytically demonstrate convergence to the global optimum ( Section 4 ) . We propose the imaginary reward on the basis of the peer prediction method ( Miller et al. , 2005 ) and apply it to self-play . The mechanism affects the gradient of the local optima , but not the global optima . The trick is to use the actions taken by the agents as feedback to verify the received signal from the every other agent , instead of the true state , input , and intent , which the agents can not fully observe . TSP only requires a modification of the baseline function for self-play ; it drastically improves the convergence to the global optimum in Comm-POSG . As the second contribution , based on the results of numerical experiments , we report that the TSP achieved state-of-the-art performance for various multi-agent tasks made of up to 20 agents ( Section 5 ) . Using predator prey ( Barrett et al. , 2011 ) , traffic junction ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) , and StarCraft Synnaeve et al . ( 2016 ) environments , which are typically used in Comm-POSG research , we compared the performances of TSP with the current neural nets , including the state-ofthe-art method , with LSTM , CommNet ( Sukhbaatar et al. , 2016 ) , and IC3Net ( Singh et al. , 2019 ) . We report that the model with IC3Net optimized by TSP has the best performance . This work is the first attempt to apply mechanism design to evolutionary learning . TSP is a general optimization algorithm whose convergence is theoretically guaranteed for arbitrary policies and environments . Furthermore , since no supervision is required , TSP has a wide range of applications to not only game AIs ( Silver et al. , 2017 ) , but also the robots ( Jaderberg et al. , 2018 ) , chatbots ( Gupta et al. , 2019 ; Chevalier et al. , 2019 ) , and autonomous cars ( Tang , 2019 ) that are employed in multiagent tasks . Notation : Vectors are columns . Let JnK : = { 1 , . . . , n } . R is a set of real numbers . i is the imaginary unit . Reu and Imu are a real and an imaginary part of complex number u , respectively . n-tuple are written as boldface of the original variables a : = 〈a1 , . . . , an〉 , and a−i is a ( n− 1 ) -tuple obtained by removing the i-th entry from a . Let 1 : = ( 1 , . . . , 1 ) T. Matrices are shown in uppercase letters L : = ( ` ij ) . E is the unit matrix . The set of probability distributions based on the support X is described as P ( X ) . 2 RELATED WORK . Neural communication has gained attention in the field of multiagent reinforcement learning ( MARL ) for both discrete ( Foerster et al. , 2016 ) and continuous ( Sukhbaatar et al. , 2016 ; Singh et al. , 2019 ) signals . Those networks are trained via self-play to exchange the internal state of the environment stored in the working memory of recurrent neural networks ( RNNs ) to learn the right policy in partially observable environments . The term self-play was coined by the game AI community in the latter half of the century . Samuel ( Samuel , 1967 ) introduced self-play as a framework for sharing a state-action value among two opposing agents to efficiently search the state space at Checkers . TD-Gammon ( Tesauro , 1995 ) introduced self-play as a framework to learn TD ( λ ) ( Sutton & Barto , 1998 ) and achieve professionalgrade levels in backgammon . AlphaGo ( Silver et al. , 2017 ) defeated the Go champion by combining supervised learning with professional game records and self-play . AlphaZero ( Silver et al. , 2018 ) successfully learnt beyond its own performance entirely based on self-play . All these studies explain that eliminating the bias of human knowledge in supervision is the advantage of self-play . Self-play is also known as evolutionary learning ( Bengio , 2012 ) in the deep learning community mainly as an approach to emerging representations without supervision ( Bansal et al. , 2018 ; Balduzzi et al. , 2019 ) . Bansal et al . ( 2018 ) show that competitive environments contribute to emerging diversity and complexity . Rich generative models such as GANs ( Goodfellow et al. , 2014 ; Radford et al. , 2016 ) are frameworks for acquiring an environmental model by employing competitive settings . RNNs such as world models ( Ha & Schmidhuber , 2018 ; Eslami et al. , 2018 ) are capable of more comprehensive ranges of exploration in partially observable environments and generation of symbols and languages ( Bengio , 2017 ; Gupta et al. , 2019 ; Chevalier et al. , 2019 ) . The difference between evolutionary learning and supervised learning is the absence of human knowledge and oracles . Several works have formalized those in which the agents exchange environmental information as a formal class of the games such as Dec-POMDP-Com ( Goldman & Zilberstein , 2003 ) and COMMTDP ( Pynadath & Tambe , 2002 ) , and several frameworks are proposed to aim to solve the problems . However , the limitation of the frameworks is that they assume a common reward . As there are yet no formal definition of non-cooperative communication game , we formalize such a game to Comm-POSG as a superset of POSGs ( Hansen et al. , 2004 ) , a more general class of multi-agent games including the cases of non-cooperativity ( Hansen et al. , 2004 ) . To the best of our knowledge , there are no studies that have introduced truthful mechanisms into the field of MARL , but it may be possible to introduce it by using agents that can learn flexibly , such as neural networks . A typical truthful mechanism is the VCG mechanism ( Vickrey , 1961 ) , which is a generalization of the pivot method used in auction theory , but whereas the subject of the report that must satisfy truthfulness must be a valuation ( or a value function if interpreted from a RL perspective ) . In this study , the scope of application is different because the belief states of the environment are subject to reporting . Therefore , we introduce instead a peer prediction method ( Miller et al. , 2005 ) that guarantees truthfulness with respect to reporting beliefs about arbitrary probability distributions using proper scoring rules ( Gneiting & Raftery , 2007 ) . 3 PROBLEM DEFINITION . 3.1 COMM-POSG . A communicative partially-observable stochastic game ( Comm-POSG ) is a class of non-cooperative Bayesian games in which every agent does not fully observe the environment but interacts each other . We define Comm-POSG as an extension of POSG ( Hansen et al. , 2004 ) with a message protocol . Definition 3.1 ( Hansen et al. , 2004 ) POSG 〈n , T , S , A , X , T , P , R〉 is a class for multi-agent decision making under uncertainty in which the state evolves over time 1 ≤ t ≤ T , where • n is the number of agents , • T is a horizon i.e. , the episode length , • S is a set of discrete/continuous state st ∈ S with an initial probabilistic distribution p ( s0 ) , • A is a set of discrete/continuous action ati ∈ A , • X is a set of discrete/continuous observation xti ∈ X , • T ∈ P ( S ×A× S ) is state transition probability , • P ∈ P ( S × Xn ) is an observation probability , and • R : S ×An → Rn is a reward function that outputs an n-dimensional vector . In Comm-POSGs , every agent further follows a message protocol Zn×n , where Z is the discrete/continuous signal space . The complete information exchanged among the agent in time is Zt , where Zt : = ( ztij ) i , j∈JnK ∈ Zn×n is a signal matrix in which ( i , j ) -th entry ztij represents a signal from Agent i to Agent j at t. The i-th diagonal entry of Zt , hti : = ztii represents the pre-state , an internal state of i-th agent before receiving the singals from the others . A game in Comm-POSG is denoted as G : = 〈n , T , S , A , X , T , P , R , Z〉 . The objective function of Comm-POSG is social welfare ( Arrow , 1963 ) defined by the following , J : = n∑ i=1 V πi ; V πi : = Eπi [ T∑ t=1 γt−1rti ] , ( 1 ) where γ ∈ [ 0 , 1 ] is discount rate , rti is reward πi is a stochastic policy , and V πi is the value function . In extensive-form games including Comm-POSG , in addition to the information in the environment , the information of other agents can not be observed . In the optimization problem under these assumptions , a policy converges to a solution called the Bayesian Nash equilibrium ( BNE ) ( Fudenberg , 1993 ) . We denote the social welfare at the BNE is J∗ , and the global maximum Ĵ . In general , J∗ 6= Ĵ holds , which is closely related to the information asymmetry .
This paper examines the setting of partially observable stochastic games where agents have the possibility of communication. The approach taken is what would be termed “direct revelation” in mechanism design: agents are supposed to reveal their full internal state / history to each other at each step. This gives the most complete information possible to enable good decisions. However, agents may not have an incentive to report truthfully, so an approach based on peer prediction is used to incentivize this. The results show improvements over prior approaches to communication in three tasks: predator prey, traffic junction, and StarCraft.
SP:631bfb07c83d98b09d95e8ad06969f8ecbe936e9
Assisting the Adversary to Improve GAN Training
1 INTRODUCTION . The generative adversarial network ( GAN ) framework ( Goodfellow et al. , 2014 ) trains a neural network known as a generator which maps from a random vector to an output such as an image . Key to training is another neural network , the adversary ( sometimes called a discriminator or critic ) , which is trained to distinguish between “ true ” and generated data . This is done by maximizing one of the many different objectives proposed in the literature ; see for instance Goodfellow et al . ( 2014 ) ; Arjovsky et al . ( 2017 ) ; Nowozin et al . ( 2016 ) . The generator directly competes against the adversary : it is trained to minimize the same objective , which it does by making the generated data more similar to the true data . GANs are efficient to sample from , requiring a single pass through a deep network , and highly flexible , as they do not require an explicit likelihood . They are especially suited to producing photo-realistic images ( Zhou et al. , 2019 ) compared to competing methods like normalizing flows , which impose strict requirements on the neural network architecture ( Kobyzev et al. , 2020 ; Rezende & Mohamed , 2015 ) and VAEs ( Kingma & Welling , 2014 ; Razavi et al. , 2019 ; Vahdat & Kautz , 2020 ) . Counterbalancing their appealing properties , GANs can have unstable training dynamics ( Kurach et al. , 2019 ; Goodfellow , 2017 ; Kodali et al. , 2017 ; Mescheder et al. , 2018 ) . Substantial research effort has been directed towards improving the training of GANs . These endeavors can generally be divided into two camps , albeit with significant overlap . The first develops better learning objectives for the generator/adversary to minimize/maximize . These are designed to have properties which improve training ( Arjovsky et al. , 2017 ; Li et al. , 2017 ; Nowozin et al. , 2016 ) . The other camp develops techniques to regularize the adversary and improve its training dynamics ( Kodali et al. , 2017 ; Roth et al. , 2017 ; Miyato et al. , 2018 ) . The adversary can then provide a better learning signal for the generator . Despite these contributions , stabilizing the training of GANs remains unsolved and continues to be an active research area . An overlooked approach is to train the generator in a way that accounts for the adversary not being trained to convergence . One such approach was introduced by Mescheder et al . ( 2017 ) and later built on by Nagarajan & Kolter ( 2017 ) . The proposed method is a regularization term based on the norm of the gradients used to train the adversary . This is motivated as a means to improve the convergence properties of the minimax game . The purpose of this paper is to provide a new perspective as to why this regularizer is appropriate . Our perspective differs in that we view it as promoting updates that lead to a solution that satisfies a sufficient condition for the adversary to be optimal . To be precise , it encourages the generator to move towards points where the adversary ’ s current parameters are optimal . Informally , this regularizer “ assists ” the adversary , and for this reason we refer to this regularization method as the Adversary ’ s Assistant ( AdvAs ) . We additionally propose a version of AdvAs which is hyperparameter-free . Furthermore , we release a library which makes it simple to integrate into existing code . We demonstrate its application to a standard architecture with the WGAN-GP objective ( Arjovsky et al. , 2017 ; Gulrajani et al. , 2017 ) ; the state-of-the-art StyleGAN2 architecture and objective introduced by Karras et al . ( 2020 ) ; and the AutoGAN architecture and objective introduced by Gong et al . ( 2019 ) . We test these on the MNIST ( Lecun et al. , 1998 ) , CelebA ( Liu et al. , 2015 ) , CIFAR10 ( Krizhevsky et al. , 2009 ) datasets respectively . We show that AdvAs improves training on all datasets , as measured by the Fréchet Inception Distance ( FID ) ( Heusel et al. , 2017 ) , and the inception score ( Salimans et al. , 2016 ) where applicable . 2 BACKGROUND . A generator is a neural network g : Z → X ⊆ Rdx which maps from a random vector z ∈ Z to an output x ∈ X ( e.g. , an image ) . Due to the distribution over z , the function g induces a distribution over its output x = g ( z ) . If g is invertible and differentiable , the probability density function ( PDF ) over x from this “ change of variables ” could be computed . This is not necessary for training GANs , meaning that no such restrictions need to be placed on the neural network g. We denote this distribution pθ ( x ) where θ ∈ Θ ⊆ Rdg denotes the generator ’ s parameters . The GAN is trained on a dataset x1 , . . . , xN , where each xi is in X . We assume that this is sampled i.i.d . from a data-generating distribution ptrue . Then the aim of training is to learn θ so that pθ is as close as possible to ptrue . Section 2.1 will make precise what is meant by “ close. ” The adversary aφ : X → A has parameters φ ∈ Φ ⊆ Rda which are typically trained alternately with the generator . It receives as input either the data or the generator ’ s outputs . The set that it maps to , A , is dependent on the GAN type . For example , Goodfellow et al . ( 2014 ) define an adversary which maps from x ∈ X to the probability that x is a “ real ” data point from the dataset , as opposed to a “ fake ” from the generator . They therefore choose A to be [ 0 , 1 ] and train the adversary by maximizing the associated log-likelihood objective , h ( pθ , aφ ) = Ex∼ptrue [ log aφ ( x ) ] + Ex∼pθ [ log ( 1− aφ ( x ) ) ] . ( 1 ) Using the intuition that the generator should generate samples that seem real and therefore “ fool ” the adversary , the generator is trained to minimize h ( pθ , aφ ) . Since we find θ to minimize this objective while fitting φ to maximize it , training a GAN is equivalent to solving the minimax game , min θ max φ h ( pθ , aφ ) . ( 2 ) Eq . ( 1 ) gives the original form for h ( pθ , aφ ) used by Goodfellow et al . ( 2014 ) but this form varies between different GANs , as we will discuss in Section 2.1 . The minimization and maximization in Eq . ( 2 ) are performed with gradient descent in practice . To be precise , we define Lgen ( θ , φ ) = h ( pθ , aφ ) and Ladv ( θ , φ ) = −h ( pθ , aφ ) . These are treated as losses for the generator and adversary respectively , and both are minimized . In other words , we turn the maximization of h ( pθ , aφ ) w.r.t . φ into a minimization of Ladv ( θ , φ ) . Then on each iteration , θ and φ are updated one after the other using gradient descent steps along their respective gradients : ∇θLgen ( θ , φ ) = ∇θh ( pθ , aφ ) , ( 3 ) ∇φLadv ( θ , φ ) = −∇φh ( pθ , aφ ) . ( 4 ) 2.1 GANS MINIMIZE DIVERGENCES . A common theme in the GAN literature is analysis based on what we call the optimal adversary assumption . This is the assumption that , before each generator update , we have found the adversary aφ which maximizes h ( pθ , aφ ) given the current value of θ . To be precise , we define a class of permissible adversary functions F . This is often simply the space of all functions mapping X → A ( Goodfellow et al. , 2014 ) , but is in some GAN variants constrained by , e.g. , a Lipschitz constant ( Arjovsky et al. , 2017 ) . Then we call the adversary aφ optimal for a particular value of θ if and only if h ( pθ , aφ ) = maxa∈F h ( pθ , a ) . In practice , the neural network aφ can not represent every a ∈ F and so it may not be able to parameterize an optimal adversary for a given θ . As is common in the literature , we assume that the neural network is expressive enough that this is not an issue , i.e. , we assume that for any θ , there exists at least one φ ∈ Φ resulting in an optimal adversary . Then , noting that there may be multiple such φ ∈ Φ , we define Φ∗ ( θ ) to be the set of all optimal adversary parameters . That is , Φ∗ ( θ ) = { φ ∈ Φ | h ( pθ , aφ ) = maxa∈F h ( pθ , a ) } and the optimal adversary assumptions says that before each update of θ we have found φ ∈ Φ∗ ( θ ) . We emphasize that , in part due to the limited number of gradient updates performed on φ , this assumption is essentially never true in practice . This paper presents a method to improve the training of GANs by addressing this issue . The optimal adversary assumption simplifies analysis of GAN training considerably . Instead of being a two-player game , it turns into a case of minimizing an objective with respect to θ alone . We denote this objective M ( pθ ) = max a∈F h ( pθ , a ) = h ( pθ , aφ∗ ) where φ∗ ∈ Φ∗ ( θ ) . ( 5 ) For example , Goodfellow et al . ( 2014 ) showed that using the objective presented in Eq . ( 1 ) results in M ( pθ ) = 2 · JSD ( ptrue||pθ ) − log 4 , where JSD is the Jensen-Shannon divergence . By making the optimal adversary assumption , they could prove that their GAN training procedure would converge , and would minimize the Jensen-Shannon divergence between ptrue and pθ . A spate of research following the introduction of the original GAN objective has similarly made use of the optimal adversary assumption to propose GANs which minimize different divergences . For example , Wasserstein GANs ( WGANs ) ( Arjovsky et al. , 2017 ) minimize a Wasserstein distance . MMD GANs ( Li et al. , 2017 ) minimize a distance known as the maximum mean discrepancy . Nowozin et al . ( 2016 ) introduce f-GANs which minimize f-divergences , a class including the Kullback-Leibler and Jensen-Shannon divergences . We emphasize that this is by no means an exhaustive list . Like these studies , this paper is motivated by the perspective that , under the optimal adversary assumption , GANs minimize a divergence . However , the GAN framework can also be viewed from a more game-theoretic perspective ( Kodali et al. , 2017 ; Grnarova et al. , 2018 ) .
This paper concerns how to efficiently regularize the generatior for training generative adversarial networks (GANs). A new regularizer for the generator loss is proposed to penalize the norm of the gradient with respect to discriminator’s parameters ($\phi$). In other words, the generator learns to encourage small norm of the discriminator’s gradient w.r.t $\phi$. The author(s) also propose a heuristic to remove the introduction of a further hyperparameter. The author(s) applied the proposed regularizer to WGAN-GP, AutoGAN, and StyleGAN2 to validate its effectiveness. Their experiments reveal that the new regularizer is promising.
SP:4e822c1ba32ac54bfc6edf160d684c8fb84bdc36
Assisting the Adversary to Improve GAN Training
1 INTRODUCTION . The generative adversarial network ( GAN ) framework ( Goodfellow et al. , 2014 ) trains a neural network known as a generator which maps from a random vector to an output such as an image . Key to training is another neural network , the adversary ( sometimes called a discriminator or critic ) , which is trained to distinguish between “ true ” and generated data . This is done by maximizing one of the many different objectives proposed in the literature ; see for instance Goodfellow et al . ( 2014 ) ; Arjovsky et al . ( 2017 ) ; Nowozin et al . ( 2016 ) . The generator directly competes against the adversary : it is trained to minimize the same objective , which it does by making the generated data more similar to the true data . GANs are efficient to sample from , requiring a single pass through a deep network , and highly flexible , as they do not require an explicit likelihood . They are especially suited to producing photo-realistic images ( Zhou et al. , 2019 ) compared to competing methods like normalizing flows , which impose strict requirements on the neural network architecture ( Kobyzev et al. , 2020 ; Rezende & Mohamed , 2015 ) and VAEs ( Kingma & Welling , 2014 ; Razavi et al. , 2019 ; Vahdat & Kautz , 2020 ) . Counterbalancing their appealing properties , GANs can have unstable training dynamics ( Kurach et al. , 2019 ; Goodfellow , 2017 ; Kodali et al. , 2017 ; Mescheder et al. , 2018 ) . Substantial research effort has been directed towards improving the training of GANs . These endeavors can generally be divided into two camps , albeit with significant overlap . The first develops better learning objectives for the generator/adversary to minimize/maximize . These are designed to have properties which improve training ( Arjovsky et al. , 2017 ; Li et al. , 2017 ; Nowozin et al. , 2016 ) . The other camp develops techniques to regularize the adversary and improve its training dynamics ( Kodali et al. , 2017 ; Roth et al. , 2017 ; Miyato et al. , 2018 ) . The adversary can then provide a better learning signal for the generator . Despite these contributions , stabilizing the training of GANs remains unsolved and continues to be an active research area . An overlooked approach is to train the generator in a way that accounts for the adversary not being trained to convergence . One such approach was introduced by Mescheder et al . ( 2017 ) and later built on by Nagarajan & Kolter ( 2017 ) . The proposed method is a regularization term based on the norm of the gradients used to train the adversary . This is motivated as a means to improve the convergence properties of the minimax game . The purpose of this paper is to provide a new perspective as to why this regularizer is appropriate . Our perspective differs in that we view it as promoting updates that lead to a solution that satisfies a sufficient condition for the adversary to be optimal . To be precise , it encourages the generator to move towards points where the adversary ’ s current parameters are optimal . Informally , this regularizer “ assists ” the adversary , and for this reason we refer to this regularization method as the Adversary ’ s Assistant ( AdvAs ) . We additionally propose a version of AdvAs which is hyperparameter-free . Furthermore , we release a library which makes it simple to integrate into existing code . We demonstrate its application to a standard architecture with the WGAN-GP objective ( Arjovsky et al. , 2017 ; Gulrajani et al. , 2017 ) ; the state-of-the-art StyleGAN2 architecture and objective introduced by Karras et al . ( 2020 ) ; and the AutoGAN architecture and objective introduced by Gong et al . ( 2019 ) . We test these on the MNIST ( Lecun et al. , 1998 ) , CelebA ( Liu et al. , 2015 ) , CIFAR10 ( Krizhevsky et al. , 2009 ) datasets respectively . We show that AdvAs improves training on all datasets , as measured by the Fréchet Inception Distance ( FID ) ( Heusel et al. , 2017 ) , and the inception score ( Salimans et al. , 2016 ) where applicable . 2 BACKGROUND . A generator is a neural network g : Z → X ⊆ Rdx which maps from a random vector z ∈ Z to an output x ∈ X ( e.g. , an image ) . Due to the distribution over z , the function g induces a distribution over its output x = g ( z ) . If g is invertible and differentiable , the probability density function ( PDF ) over x from this “ change of variables ” could be computed . This is not necessary for training GANs , meaning that no such restrictions need to be placed on the neural network g. We denote this distribution pθ ( x ) where θ ∈ Θ ⊆ Rdg denotes the generator ’ s parameters . The GAN is trained on a dataset x1 , . . . , xN , where each xi is in X . We assume that this is sampled i.i.d . from a data-generating distribution ptrue . Then the aim of training is to learn θ so that pθ is as close as possible to ptrue . Section 2.1 will make precise what is meant by “ close. ” The adversary aφ : X → A has parameters φ ∈ Φ ⊆ Rda which are typically trained alternately with the generator . It receives as input either the data or the generator ’ s outputs . The set that it maps to , A , is dependent on the GAN type . For example , Goodfellow et al . ( 2014 ) define an adversary which maps from x ∈ X to the probability that x is a “ real ” data point from the dataset , as opposed to a “ fake ” from the generator . They therefore choose A to be [ 0 , 1 ] and train the adversary by maximizing the associated log-likelihood objective , h ( pθ , aφ ) = Ex∼ptrue [ log aφ ( x ) ] + Ex∼pθ [ log ( 1− aφ ( x ) ) ] . ( 1 ) Using the intuition that the generator should generate samples that seem real and therefore “ fool ” the adversary , the generator is trained to minimize h ( pθ , aφ ) . Since we find θ to minimize this objective while fitting φ to maximize it , training a GAN is equivalent to solving the minimax game , min θ max φ h ( pθ , aφ ) . ( 2 ) Eq . ( 1 ) gives the original form for h ( pθ , aφ ) used by Goodfellow et al . ( 2014 ) but this form varies between different GANs , as we will discuss in Section 2.1 . The minimization and maximization in Eq . ( 2 ) are performed with gradient descent in practice . To be precise , we define Lgen ( θ , φ ) = h ( pθ , aφ ) and Ladv ( θ , φ ) = −h ( pθ , aφ ) . These are treated as losses for the generator and adversary respectively , and both are minimized . In other words , we turn the maximization of h ( pθ , aφ ) w.r.t . φ into a minimization of Ladv ( θ , φ ) . Then on each iteration , θ and φ are updated one after the other using gradient descent steps along their respective gradients : ∇θLgen ( θ , φ ) = ∇θh ( pθ , aφ ) , ( 3 ) ∇φLadv ( θ , φ ) = −∇φh ( pθ , aφ ) . ( 4 ) 2.1 GANS MINIMIZE DIVERGENCES . A common theme in the GAN literature is analysis based on what we call the optimal adversary assumption . This is the assumption that , before each generator update , we have found the adversary aφ which maximizes h ( pθ , aφ ) given the current value of θ . To be precise , we define a class of permissible adversary functions F . This is often simply the space of all functions mapping X → A ( Goodfellow et al. , 2014 ) , but is in some GAN variants constrained by , e.g. , a Lipschitz constant ( Arjovsky et al. , 2017 ) . Then we call the adversary aφ optimal for a particular value of θ if and only if h ( pθ , aφ ) = maxa∈F h ( pθ , a ) . In practice , the neural network aφ can not represent every a ∈ F and so it may not be able to parameterize an optimal adversary for a given θ . As is common in the literature , we assume that the neural network is expressive enough that this is not an issue , i.e. , we assume that for any θ , there exists at least one φ ∈ Φ resulting in an optimal adversary . Then , noting that there may be multiple such φ ∈ Φ , we define Φ∗ ( θ ) to be the set of all optimal adversary parameters . That is , Φ∗ ( θ ) = { φ ∈ Φ | h ( pθ , aφ ) = maxa∈F h ( pθ , a ) } and the optimal adversary assumptions says that before each update of θ we have found φ ∈ Φ∗ ( θ ) . We emphasize that , in part due to the limited number of gradient updates performed on φ , this assumption is essentially never true in practice . This paper presents a method to improve the training of GANs by addressing this issue . The optimal adversary assumption simplifies analysis of GAN training considerably . Instead of being a two-player game , it turns into a case of minimizing an objective with respect to θ alone . We denote this objective M ( pθ ) = max a∈F h ( pθ , a ) = h ( pθ , aφ∗ ) where φ∗ ∈ Φ∗ ( θ ) . ( 5 ) For example , Goodfellow et al . ( 2014 ) showed that using the objective presented in Eq . ( 1 ) results in M ( pθ ) = 2 · JSD ( ptrue||pθ ) − log 4 , where JSD is the Jensen-Shannon divergence . By making the optimal adversary assumption , they could prove that their GAN training procedure would converge , and would minimize the Jensen-Shannon divergence between ptrue and pθ . A spate of research following the introduction of the original GAN objective has similarly made use of the optimal adversary assumption to propose GANs which minimize different divergences . For example , Wasserstein GANs ( WGANs ) ( Arjovsky et al. , 2017 ) minimize a Wasserstein distance . MMD GANs ( Li et al. , 2017 ) minimize a distance known as the maximum mean discrepancy . Nowozin et al . ( 2016 ) introduce f-GANs which minimize f-divergences , a class including the Kullback-Leibler and Jensen-Shannon divergences . We emphasize that this is by no means an exhaustive list . Like these studies , this paper is motivated by the perspective that , under the optimal adversary assumption , GANs minimize a divergence . However , the GAN framework can also be viewed from a more game-theoretic perspective ( Kodali et al. , 2017 ; Grnarova et al. , 2018 ) .
This paper proposes a new regularizer to improve GAN training. By noticing that the discriminator does not always reach optimum at each iteration, this paper proposes Adversary's Assistant (AdvAs) for helping the discriminator to satisfy this condition. Interestingly, compared to the previous methods for improving GAN training, this work applies the regularizer at the generator (rather than the discriminator) and is theoretical motivated. Experiments on several GAN objectives, datasets and network architectures are provided to support the effectiveness of AdvAs.
SP:4e822c1ba32ac54bfc6edf160d684c8fb84bdc36
Median DC for Sign Recovery: Privacy can be Achieved by Deterministic Algorithms
1 INTRODUCTION . With the development of technology for data acquisition and storage , the modern dataset has a larger scale , more complex structure , and more practical considerations , which addresses new challenges for data analysis . In recent years , large quantities of sensitive data are collected by individuals and companies . While one wants to extract more accurate statistical information from the distributed dataset , we must also beware of the leakage of this sensitive personal information during the training process . This calls for the study of distributed learning under privacy constraints ( Pathak et al. , 2010 ; Hamm et al. , 2016 ; Jayaraman et al. , 2018 ) . In privacy literature , differential privacy , which was firstly proposed in Dwork et al . ( 2006 ) , has been the most widely adopted definition of privacy tailored to statistical data analysis . It has achieved tremendous success in real-world applications . Denote the data universe to be X , for the dataset X = { Xi } ni=1 ∈ Xn where Xi ’ s are the data observations . The ( , δ ) -differentially privacy can be defined as follows . Definition 1 . ( Differential Privacy in Dwork et al . ( 2006 ) ) A randomized algorithm A : Xn → Θ gives ( , δ ) -differentially private if for any pair of adjacent datasets X ∈ Xn and X′ ∈ Xn , there always holds P { A ( X1 : n ) ∈ U } ≤ e · P { A ( X′1 : n ) ∈ U } + δ , ( 1 ) for every subset U ⊆ Θ . Here two datasets X and X′ are adjacent if and only if the Hamming distance ( Lei , 2011 ) of these two datasets of same size H ( X , X′ ) = 1 . As we can see , the quantities and δ measure the level of privacy loss . There are also several relaxations of differential privacy ( see , e.g. , Bun & Steinke ( 2016 ) ; Dwork & Rothblum ( 2016 ) ; Mironov ( 2017 ) ; Dong et al . ( 2019 ) ) designed for the ease of analysis . However , in these definitions , the dataset X is always assumed to be fixed , and the probability in ( 1 ) only takes over the randomness of the algorithm A . Therefore , it is impossible to achieve strict differential privacy without adding auxiliary perturbations in the algorithm . On the other hand , the statistical performance of the output is inevitably deteriorated by the additional randomness . This lead to a large body of works discussing the tradeoff between accuracy and privacy ( Wasserman & Zhou , 2010 ; Bassily et al. , 2014 ; Bun et al. , 2018 ; Duchi et al. , 2018 ; Cai et al. , 2019 ) . In this paper , we consider the private sign recovery problem in the distributed system . To be more precise , assume the parameter of interest is a sparse vector , which has many zeros in its entries . The task is to identify the signs of the parameter from the observations stored in multiple machines while protecting each individual ’ s privacy . The sign recovery problem , as an extension of sparsity pattern recovery , has found its significance in a broad variety of contexts , including variable selection ( Tibshirani , 1996 ; Miller , 2002 ) , graphical models ( Meinshausen & Bühlmann , 2006 ; Cai et al. , 2011 ) , compressed sensing ( Candes & Tao , 2005 ; Donoho , 2006 ) , and signal denoising ( Chen et al. , 2001 ) . However , this problem is rarely considered in the privacy community . To address the sign recovery problem , we propose the Median Divide-and-Conquer ( Med-DC ) method , a simple two-step procedure . Firstly , each local machine estimates the sparse parameter and sends the sign-vectors back to the server ; Secondly , the server aggregates these sign-vectors using coordinate-wise median and output the final sign estimator . While mean based divide-andconquer ( also referred to as Mean-DC ) approaches have been widely analyzed in distributed learning literature ( Mcdonald et al. , 2009 ; Zhang et al. , 2013 ; Lee et al. , 2017 ; Battey et al. , 2018 ) , the median-based counterpart has not yet been well explored . It is well-known that naively averaging the local estimators behaves badly for nonlinear and penalized optimization problems . This is because averaging can not reduce the bias in the local sub-problems . In particular , for the distributed Lasso problem , as mentioned in Lee et al . ( 2017 ) , the estimation error of averaged local Lasso estimator is of the same order as that of local estimators . However , when only considering the sign recovery problem , we found that the Med-DC method perfectly fits the nature of the distributed private setup . ( See Section 2.2 for more detailed discussions ) For the sake of clarity , we only consider the sign recovery problem for sparse mean estimation and sparse linear regression , the two fundamental models in statistics . The proposed Med-DC method has the following advantages : • Consistent recovery . For both sparse mean estimation and sparse linear regression , the Med-DC method consistently recovers the signs of the true parameter with theoretical guarantees . Under some constraints , we can prove that our approach can identify signals larger thanC √ log n/N for some constant C > 0 ( where N is the full sample size and n is the local sample size ) , which coincides with the minimal signal level in the single machine setting ( all data stored in one machine ) . • Efficient communication . To recover the signs of the parameter of interest in the distributed setup , a naive approach is to estimate the parameter using existing private distributed estimation methods and take the signs of the estimators . However , these methods usually involve multi-round aggregation of gradient information or local estimators , which seems costly for the simple sign recovery problem . Instead , our approach only aggregates the vectors of signs ( bits information ) in one shot , which is much more communicationally efficient . •Weak privacy . By relaxing the differential privacy to high-probability sense , our deterministic Med-DC method can be proved to be weakly ‘ private ’ . We also extend this concept to group privacy . To the best of our knowledge , this is the first deterministic algorithm that has a provable high-probability privacy guarantee . Moreover , as each machine only needs to transmit the vectors of signs , instead of the local estimators or gradient vectors , our proposed method also protects the privacy of each local machine , since gradient sharing can also result in privacy leakage ( Zhu et al. , 2019 ) . •Wide applicability . We believe the Med-DC approach deserves more attention due to its excellent practical performance and ease of implementation . For example , it is promising to apply the Med-DC method to wider classes of models , ( e.g . , generalized linear model , M -estimation , etc . ) or hybridize this method with many sophisticated distributed algorithms like averaged de-biased estimator in Lee et al . ( 2017 ) and Communication-Efficient Accurate Statistical Estimator ( CEASE ) in Fan et al . ( 2019 ) . Notations . For every vector v = ( v1 , ... , vp ) T , denote |v|2 = √∑p l=1 v 2 l , |v|1 = ∑p l=1 |vl| , and |v|∞ = max1≤l≤p |vl| . Moreover , we use supp ( v ) = { 1 ≤ l ≤ p | vl 6= 0 } as the support of the vector v , and v−l = ( v1 , . . . , vl−1 , vl+1 , . . . , vp ) T. For every matrix A ∈ Rp1×p2 , define ‖A‖ = sup|v|2=1 |Av|2 , ‖A‖∞ = max1≤l1≤p1,1≤l2≤p2 |Al1 , l2 | , ‖A‖L∞ = sup|v|∞=1 |Av|∞ as various matrix norms , Λmax ( A ) and Λmin ( A ) as the largest and smallest eigenvalues ofA respectively . We will use I ( · ) as the indicator function and sgn ( · ) as the sign function . For two sequences an , bn , we say an bn when an = O ( bn ) and bn = O ( an ) hold at the same time . For simplicity , we denote Sp−1 and Bp as the unit sphere and unit ball in Rp centered at 0 . For a sequence of vectors { vi } ni=1 ⊆ Rp , we denote med ( · ) as the coordinate-wise median . Lastly , the generic constants are assumed to be independent of m , n , and p . 2 PRIVATE SIGN RECOVERY OF MEAN VECTOR . 2.1 MEDIAN BASED DIVIDE-AND-CONQUER . Let µ∗ = ( µ∗1 , . . . , µ ∗ p ) T be the true parameter of interest . We assume the vector is sparse in the sense that many entries µ∗l are zero . There are N i.i.d . observations Xi ’ s satisfying E [ Xi ] = µ∗ , and they are evenly stored in m different machines Hj ( where 1 ≤ j ≤ m ) . Denote X = { X1 , . . . , XN } as the full dataset . For simplicity we assume N = mn so that each machine has equally n samples . Our task is to identify the signs of µ∗ on all coordinates ( denoted as sgn ( µ∗ ) ) in this distributed setup while protecting the privacy of every elementXi on each machineHj . To recover the signs of the true mean vector µ∗ privately , the most direct way is to estimate the mean by some existing differentially private algorithms and take the signs of the estimator coordinatewisely . By post-processing property of differential privacy ( Proposition 2.1 in Dwork & Roth ( 2014 ) ) , we know this sign recovery method is also differentially private . Private mean estimation is a fundamental problem in private statistical analysis and has been studied intensively ( Dwork et al. , 2006 ; Lei , 2011 ; Bassily et al. , 2014 ; Cai et al. , 2019 ) . The standard approach is to project the data onto a known bounded domain , and then apply the noises according to the diameter of the feasible domain and the privacy level . However , this method requires input data or the true parameter lies in a known bounded domain , which seems unsatisfactory in practice . Moreover , since we only want to estimate the signs , which take value in the discrete set { −1 , 0 , 1 } , it seems unnecessary to perturb the mean directly . Indeed , to recover the signs of the true parameter , there is no need to obtain an accurate mean with all data . Instead , we propose a Median based Divide-and-Conquer ( Med-DC ) approach . To be more precise , we can estimate the signs on each local machine Hj , and aggregate these vectors of signs by taking median to produce a more accurate sign estimator . To present our method more clearly , we define the following quantization function Qλ ( · ) , Qλ ( x ) = sgn { sgn ( x ) · ( |x| − λ ) +︸ ︷︷ ︸ shrinkage operator } = { sgn ( x ) if |x| > λ , 0 if |x| ≤ λ . ( 2 ) Here λ is a thresholding parameter . When x is a vector , Qλ ( x ) performs the above operation coordinate-wisely . In particular , when λ = 0 , the function Q0 ( · ) acts the same as the sign function sgn ( · ) . Then we present our method in Algorithm 1 . Algorithm 1 Median divide-and-conquer ( Med-DC ) for sparse mean estimator . Input : Dataset X = { X1 , . . . , XN } evenly divided into m local machines Hj ( where j = 1 , . . . , m ) , the universal thresholding parameter λN . 1 : for j = 1 , . . . , m do 2 : The j-th machine Hj computes the local sample mean X̄j = n−1 ∑ i∈Hj Xi . Then Hj sendsQj = QλN ( X̄j ) to the server . 3 : end for 4 : The server takes coordinate-wise median Q̂ ( X ) = med ( QλN ( X̄j ) | 1 ≤ j ≤ m ) , ( 3 ) Output : The vector of signs Q̂ ( X ) . The choice of thresholding parameter will be discussed after Theorem 1 in Section 2.3 . Especially mention that there are some cases when the median is not uniquely determined . For example , it is possible that there are the same numbers of 0 ’ s and 1 ’ s , then the median can be arbitrary value in [ 0 , 1 ] . To avoid ambiguity , we simply take Q̂l ( X ) = 0 ( where l denotes the coordinate index ) whenever the median Q̂l ( X ) is not unique . Another important remark is that , the proposed sign recovery algorithm Q̂ ( · ) is deterministic . More precisely , as there is no additional random perturbation in Algorithm 1 , the output Q̂ ( X ) is completely determined by the input dataset X . It is able to protect data privacy in a weaker sense .
The paper gives "almost private" algorithms for problem of sign recovery of mean vector and of linear regression. The techniques follow their general framework of Median DC, which is similar to the well-known median-of-means approach. They give theoretical guarantees for the same, along with empirical results comparing with known differentially private algorithms and their non-private counterparts.
SP:adad16c183ae1c2806036fef3ae2f6038943ee33
Median DC for Sign Recovery: Privacy can be Achieved by Deterministic Algorithms
1 INTRODUCTION . With the development of technology for data acquisition and storage , the modern dataset has a larger scale , more complex structure , and more practical considerations , which addresses new challenges for data analysis . In recent years , large quantities of sensitive data are collected by individuals and companies . While one wants to extract more accurate statistical information from the distributed dataset , we must also beware of the leakage of this sensitive personal information during the training process . This calls for the study of distributed learning under privacy constraints ( Pathak et al. , 2010 ; Hamm et al. , 2016 ; Jayaraman et al. , 2018 ) . In privacy literature , differential privacy , which was firstly proposed in Dwork et al . ( 2006 ) , has been the most widely adopted definition of privacy tailored to statistical data analysis . It has achieved tremendous success in real-world applications . Denote the data universe to be X , for the dataset X = { Xi } ni=1 ∈ Xn where Xi ’ s are the data observations . The ( , δ ) -differentially privacy can be defined as follows . Definition 1 . ( Differential Privacy in Dwork et al . ( 2006 ) ) A randomized algorithm A : Xn → Θ gives ( , δ ) -differentially private if for any pair of adjacent datasets X ∈ Xn and X′ ∈ Xn , there always holds P { A ( X1 : n ) ∈ U } ≤ e · P { A ( X′1 : n ) ∈ U } + δ , ( 1 ) for every subset U ⊆ Θ . Here two datasets X and X′ are adjacent if and only if the Hamming distance ( Lei , 2011 ) of these two datasets of same size H ( X , X′ ) = 1 . As we can see , the quantities and δ measure the level of privacy loss . There are also several relaxations of differential privacy ( see , e.g. , Bun & Steinke ( 2016 ) ; Dwork & Rothblum ( 2016 ) ; Mironov ( 2017 ) ; Dong et al . ( 2019 ) ) designed for the ease of analysis . However , in these definitions , the dataset X is always assumed to be fixed , and the probability in ( 1 ) only takes over the randomness of the algorithm A . Therefore , it is impossible to achieve strict differential privacy without adding auxiliary perturbations in the algorithm . On the other hand , the statistical performance of the output is inevitably deteriorated by the additional randomness . This lead to a large body of works discussing the tradeoff between accuracy and privacy ( Wasserman & Zhou , 2010 ; Bassily et al. , 2014 ; Bun et al. , 2018 ; Duchi et al. , 2018 ; Cai et al. , 2019 ) . In this paper , we consider the private sign recovery problem in the distributed system . To be more precise , assume the parameter of interest is a sparse vector , which has many zeros in its entries . The task is to identify the signs of the parameter from the observations stored in multiple machines while protecting each individual ’ s privacy . The sign recovery problem , as an extension of sparsity pattern recovery , has found its significance in a broad variety of contexts , including variable selection ( Tibshirani , 1996 ; Miller , 2002 ) , graphical models ( Meinshausen & Bühlmann , 2006 ; Cai et al. , 2011 ) , compressed sensing ( Candes & Tao , 2005 ; Donoho , 2006 ) , and signal denoising ( Chen et al. , 2001 ) . However , this problem is rarely considered in the privacy community . To address the sign recovery problem , we propose the Median Divide-and-Conquer ( Med-DC ) method , a simple two-step procedure . Firstly , each local machine estimates the sparse parameter and sends the sign-vectors back to the server ; Secondly , the server aggregates these sign-vectors using coordinate-wise median and output the final sign estimator . While mean based divide-andconquer ( also referred to as Mean-DC ) approaches have been widely analyzed in distributed learning literature ( Mcdonald et al. , 2009 ; Zhang et al. , 2013 ; Lee et al. , 2017 ; Battey et al. , 2018 ) , the median-based counterpart has not yet been well explored . It is well-known that naively averaging the local estimators behaves badly for nonlinear and penalized optimization problems . This is because averaging can not reduce the bias in the local sub-problems . In particular , for the distributed Lasso problem , as mentioned in Lee et al . ( 2017 ) , the estimation error of averaged local Lasso estimator is of the same order as that of local estimators . However , when only considering the sign recovery problem , we found that the Med-DC method perfectly fits the nature of the distributed private setup . ( See Section 2.2 for more detailed discussions ) For the sake of clarity , we only consider the sign recovery problem for sparse mean estimation and sparse linear regression , the two fundamental models in statistics . The proposed Med-DC method has the following advantages : • Consistent recovery . For both sparse mean estimation and sparse linear regression , the Med-DC method consistently recovers the signs of the true parameter with theoretical guarantees . Under some constraints , we can prove that our approach can identify signals larger thanC √ log n/N for some constant C > 0 ( where N is the full sample size and n is the local sample size ) , which coincides with the minimal signal level in the single machine setting ( all data stored in one machine ) . • Efficient communication . To recover the signs of the parameter of interest in the distributed setup , a naive approach is to estimate the parameter using existing private distributed estimation methods and take the signs of the estimators . However , these methods usually involve multi-round aggregation of gradient information or local estimators , which seems costly for the simple sign recovery problem . Instead , our approach only aggregates the vectors of signs ( bits information ) in one shot , which is much more communicationally efficient . •Weak privacy . By relaxing the differential privacy to high-probability sense , our deterministic Med-DC method can be proved to be weakly ‘ private ’ . We also extend this concept to group privacy . To the best of our knowledge , this is the first deterministic algorithm that has a provable high-probability privacy guarantee . Moreover , as each machine only needs to transmit the vectors of signs , instead of the local estimators or gradient vectors , our proposed method also protects the privacy of each local machine , since gradient sharing can also result in privacy leakage ( Zhu et al. , 2019 ) . •Wide applicability . We believe the Med-DC approach deserves more attention due to its excellent practical performance and ease of implementation . For example , it is promising to apply the Med-DC method to wider classes of models , ( e.g . , generalized linear model , M -estimation , etc . ) or hybridize this method with many sophisticated distributed algorithms like averaged de-biased estimator in Lee et al . ( 2017 ) and Communication-Efficient Accurate Statistical Estimator ( CEASE ) in Fan et al . ( 2019 ) . Notations . For every vector v = ( v1 , ... , vp ) T , denote |v|2 = √∑p l=1 v 2 l , |v|1 = ∑p l=1 |vl| , and |v|∞ = max1≤l≤p |vl| . Moreover , we use supp ( v ) = { 1 ≤ l ≤ p | vl 6= 0 } as the support of the vector v , and v−l = ( v1 , . . . , vl−1 , vl+1 , . . . , vp ) T. For every matrix A ∈ Rp1×p2 , define ‖A‖ = sup|v|2=1 |Av|2 , ‖A‖∞ = max1≤l1≤p1,1≤l2≤p2 |Al1 , l2 | , ‖A‖L∞ = sup|v|∞=1 |Av|∞ as various matrix norms , Λmax ( A ) and Λmin ( A ) as the largest and smallest eigenvalues ofA respectively . We will use I ( · ) as the indicator function and sgn ( · ) as the sign function . For two sequences an , bn , we say an bn when an = O ( bn ) and bn = O ( an ) hold at the same time . For simplicity , we denote Sp−1 and Bp as the unit sphere and unit ball in Rp centered at 0 . For a sequence of vectors { vi } ni=1 ⊆ Rp , we denote med ( · ) as the coordinate-wise median . Lastly , the generic constants are assumed to be independent of m , n , and p . 2 PRIVATE SIGN RECOVERY OF MEAN VECTOR . 2.1 MEDIAN BASED DIVIDE-AND-CONQUER . Let µ∗ = ( µ∗1 , . . . , µ ∗ p ) T be the true parameter of interest . We assume the vector is sparse in the sense that many entries µ∗l are zero . There are N i.i.d . observations Xi ’ s satisfying E [ Xi ] = µ∗ , and they are evenly stored in m different machines Hj ( where 1 ≤ j ≤ m ) . Denote X = { X1 , . . . , XN } as the full dataset . For simplicity we assume N = mn so that each machine has equally n samples . Our task is to identify the signs of µ∗ on all coordinates ( denoted as sgn ( µ∗ ) ) in this distributed setup while protecting the privacy of every elementXi on each machineHj . To recover the signs of the true mean vector µ∗ privately , the most direct way is to estimate the mean by some existing differentially private algorithms and take the signs of the estimator coordinatewisely . By post-processing property of differential privacy ( Proposition 2.1 in Dwork & Roth ( 2014 ) ) , we know this sign recovery method is also differentially private . Private mean estimation is a fundamental problem in private statistical analysis and has been studied intensively ( Dwork et al. , 2006 ; Lei , 2011 ; Bassily et al. , 2014 ; Cai et al. , 2019 ) . The standard approach is to project the data onto a known bounded domain , and then apply the noises according to the diameter of the feasible domain and the privacy level . However , this method requires input data or the true parameter lies in a known bounded domain , which seems unsatisfactory in practice . Moreover , since we only want to estimate the signs , which take value in the discrete set { −1 , 0 , 1 } , it seems unnecessary to perturb the mean directly . Indeed , to recover the signs of the true parameter , there is no need to obtain an accurate mean with all data . Instead , we propose a Median based Divide-and-Conquer ( Med-DC ) approach . To be more precise , we can estimate the signs on each local machine Hj , and aggregate these vectors of signs by taking median to produce a more accurate sign estimator . To present our method more clearly , we define the following quantization function Qλ ( · ) , Qλ ( x ) = sgn { sgn ( x ) · ( |x| − λ ) +︸ ︷︷ ︸ shrinkage operator } = { sgn ( x ) if |x| > λ , 0 if |x| ≤ λ . ( 2 ) Here λ is a thresholding parameter . When x is a vector , Qλ ( x ) performs the above operation coordinate-wisely . In particular , when λ = 0 , the function Q0 ( · ) acts the same as the sign function sgn ( · ) . Then we present our method in Algorithm 1 . Algorithm 1 Median divide-and-conquer ( Med-DC ) for sparse mean estimator . Input : Dataset X = { X1 , . . . , XN } evenly divided into m local machines Hj ( where j = 1 , . . . , m ) , the universal thresholding parameter λN . 1 : for j = 1 , . . . , m do 2 : The j-th machine Hj computes the local sample mean X̄j = n−1 ∑ i∈Hj Xi . Then Hj sendsQj = QλN ( X̄j ) to the server . 3 : end for 4 : The server takes coordinate-wise median Q̂ ( X ) = med ( QλN ( X̄j ) | 1 ≤ j ≤ m ) , ( 3 ) Output : The vector of signs Q̂ ( X ) . The choice of thresholding parameter will be discussed after Theorem 1 in Section 2.3 . Especially mention that there are some cases when the median is not uniquely determined . For example , it is possible that there are the same numbers of 0 ’ s and 1 ’ s , then the median can be arbitrary value in [ 0 , 1 ] . To avoid ambiguity , we simply take Q̂l ( X ) = 0 ( where l denotes the coordinate index ) whenever the median Q̂l ( X ) is not unique . Another important remark is that , the proposed sign recovery algorithm Q̂ ( · ) is deterministic . More precisely , as there is no additional random perturbation in Algorithm 1 , the output Q̂ ( X ) is completely determined by the input dataset X . It is able to protect data privacy in a weaker sense .
The paper considers the sign recovery problem in a distributed setting with privacy constraints. The paper proposes an algorithm “median divide-and-conquer (Med-DC)” which takes the sign locally in each machine and then takes the median globally. The paper shows that in the sparse mean estimation setting, Med-DC is correct with high probability under some assumptions and Med-DC satisfies a weaker notion of differential privacy proposed by the paper. The paper then extends this algorithm to the sparse linear regression setting.
SP:adad16c183ae1c2806036fef3ae2f6038943ee33
Implicit Normalizing Flows
1 INTRODUCTION . Normalizing flows ( NFs ) ( Rezende & Mohamed , 2015 ; Dinh et al. , 2014 ) are promising methods for density modeling . NFs define a model distribution px ( x ) by specifying an invertible transformation f ( x ) from x to another random variable z . By change-of-variable formula , the model density is ln px ( x ) = ln pz ( f ( x ) ) + ln |det ( Jf ( x ) ) | , ( 1 ) where pz ( z ) follows a simple distribution , such as Gaussian . NFs are particularly attractive due to their tractability , i.e. , the model density px ( x ) can be directly evaluated as Eqn . ( 1 ) . To achieve such tractability , NF models should satisfy two requirements : ( i ) the mapping between x and z is invertible ; ( ii ) the log-determinant of the Jacobian Jf ( x ) is tractable . Searching for rich model families that satisfy these tractability constraints is crucial for the advance of normalizing flow research . For the second requirement , earlier works such as inverse autoregressive flow ( Kingma et al. , 2016 ) and RealNVP ( Dinh et al. , 2017 ) restrict the model family to those with triangular Jacobian matrices . More recently , there emerge some free-form Jacobian approaches , such as Residual Flows ( ResFlows ) ( Behrmann et al. , 2019 ; Chen et al. , 2019 ) . They relax the triangular Jacobian constraint by utilizing a stochastic estimator of the log-determinant , enriching the model family . However , the Lipschitz constant of each transformation block is constrained for invertibility . In general , this is not preferable because mapping a simple prior distribution to a potentially complex data distribution may require a transformation with a very large Lipschitz constant ( See Fig . 3 for a 2D example ) . Moreover , all the aforementioned methods assume that there exists an explicit forward mapping z = f ( x ) . Bijections with explicit forward mapping only covers a fraction of the broad class of invertible functions suggested by the first requirement , which may limit the model capacity . In this paper , we propose implicit flows ( ImpFlows ) to generalize NFs , allowing the transformation to be implicitly defined by an equation F ( z , x ) = 0 . Given x ( or z ) , the other variable can be computed by an implicit root-finding procedure z = RootFind ( F ( · , x ) ) . An explicit mapping z = f ( x ) used in prior NFs can viewed as a special case of ImpFlows in the form of F ( z , x ) = f ( x ) − z = ∗Corresponding Author . 0 . To balance between expressiveness and tractability , we present a specific from of ImpFlows , where each block is the composition of a ResFlow block and the inverse of another ResFlow block . We theoretically study the model capacity of ResFlows and ImpFlows in the function space . We show that the function family of single-block ImpFlows is strictly richer than that of two-block ResFlows by relaxing the Lipschitz constraints . Furthermore , for any ResFlow with a fixed number of blocks , there exists some invertible function that ResFlow has non-negligible approximation error , but ImpFlow can exactly model . On the practical side , we develop a scalable algorithm to estimate the probability density and its gradients , and draw samples from ImpFlows . The algorithm leverages the implicit differentiation formula . Despite being more powerful , the gradient computation of ImpFlow is mostly similar with that of ResFlows , except some additional overhead on root finding . We test the effectiveness of ImpFlow on several classification and generative modeling tasks . ImpFlow outperforms ResFlow on all the benchmarks , with comparable model sizes and computational cost . 2 RELATED WORK . Expressive Normalizing Flows There are many works focusing on improving the capacity of NFs . For example , Dinh et al . ( 2014 ; 2017 ) ; Kingma & Dhariwal ( 2018 ) ; Ho et al . ( 2019 ) ; Song et al . ( 2019 ) ; Hoogeboom et al . ( 2019 ) ; De Cao et al . ( 2020 ) ; Durkan et al . ( 2019 ) design dedicated model architectures with tractable Jacobian . More recently , Grathwohl et al . ( 2019 ) ; Behrmann et al . ( 2019 ) ; Chen et al . ( 2019 ) propose NFs with free-form Jacobian , which approximate the determinant with stochastic estimators . In parallel with architecture design , Chen et al . ( 2020 ) ; Huang et al . ( 2020 ) ; Cornish et al . ( 2020 ) ; Nielsen et al . ( 2020 ) improve the capacity of NFs by operating in a higher-dimensional space . As mentioned in the introduction , all these existing works adopt explicit forward mappings , which is only a subset of the broad class of invertible functions . In contrast , the implicit function family we consider is richer . While we primarily discuss the implicit generalization of ResFlows ( Chen et al. , 2019 ) in this paper , the general idea of utilizing implicit invertible functions could be potentially applied to other models as well . Finally , Zhang et al . ( 2020 ) formally prove that the model capacity of ResFlows is restricted by the dimension of the residual blocks . In comparison , we study another limitation of ResFlows in terms of the bounded Lipschitz constant , and compare the function family of ResFlows and ImpFlows with a comparable depth . Continuous Time Flows ( CTFs ) ( Chen et al. , 2018b ; Grathwohl et al. , 2019 ; Chen et al. , 2018a ) are flexible alternative to discrete time flows for generative modeling . They typically treat the invertible transformation as a dynamical system , which is approximately simulated by ordinary differential equation ( ODE ) solvers . In contrast , the implicit function family considered in this paper does not contain differential equations , and only requires fixed point solvers . Moreover , the theoretical guarantee is different . While CTFs typically study the universal approximation capacity under the continuous time case ( i.e. , “ infinite depth ” limit ) , we consider the model capacity of ImpFlows and ResFlows under a finite number of transformation steps . Finally , while CTFs are flexible , their learning is challenging due to instability ( Liu et al. , 2020 ; Massaroli et al. , 2020 ) and exceedingly many ODE solver steps ( Finlay et al. , 2020 ) , making their large-scale application still an open problem . Implicit Deep Learning Utilizing implicit functions enhances the flexibility of neural networks , enabling the design of network layers in a problem-specific way . For instance , Bai et al . ( 2019 ) propose a deep equilibrium model as a compact replacement of recurrent networks ; Amos & Kolter ( 2017 ) generalize each layer to solve an optimization problem ; Wang et al . ( 2019 ) integrate logical reasoning into neural networks ; Reshniak & Webster ( 2019 ) utilize the implicit Euler method to improve the stability of both forward and backward processes for residual blocks ; and Sitzmann et al . ( 2020 ) incorporate periodic functions for representation learning . Different from these works , which consider implicit functions as a replacement to feed-forward networks , we develop invertible implicit functions for normalizing flows , discuss the conditions of the existence of such functions , and theoretically study the model capacity of our proposed ImpFlow in the function space . 3 IMPLICIT NORMALIZING FLOWS . We now present implicit normalizing flows , by starting with a brief overview of existing work . 3.1 NORMALIZING FLOWS . As shown in Eqn . ( 1 ) , a normalizing flow f : x 7→ z is an invertible function that defines a probability distribution with the change-of-variable formula . The modeling capacity of normalizing flows depends on the expressiveness of the invertible function f . Residual flows ( ResFlows ) ( Chen et al. , 2019 ; Behrmann et al. , 2019 ) are a particular powerful class of NFs due to their free-form Jacobian . ResFlows use f = fL ◦ · · · ◦ f1 to construct the invertible mapping , where each layer fl is an invertible residual network with Lipschitz constraints bounded by a fixed constant κ : fl ( x ) = x+ gl ( x ) , Lip ( gl ) ≤ κ < 1 , ( 2 ) where Lip ( g ) is the Lipschitz constant of a function g ( see Sec . 4.1 for details ) . Despite their free-form Jacobian , the model capacity of ResFlows is still limited by the Lipschitz constant of the invertible function . The Lipschitz constant of each ResFlow block fl can not exceed 2 ( Behrmann et al. , 2019 ) , so the Lipschitz constant of an L-block ResFlow can not exceed 2L . However , to transfer a simple prior distribution to a potentially complex data distribution , the Lipschitz constant of the transformation can be required to be sufficiently large in general . Therefore , ResFlows can be undesirably deep simply to meet the Lipschitz constraints ( see Fig . 3 for a 2D example ) . Below , we present implicit flows ( ImpFlows ) to relax the Lipschitz constraints . 3.2 MODEL SPECIFICATION . In general , an implicit flow ( ImpFlow ) is defined as an invertible mapping between random variables x and z of dimension d by finding the roots of F ( z , x ) = 0 , where F is a function from R2d to Rd . In particular , the explicit mappings z = f ( x ) used in prior flow instances ( Chen et al. , 2019 ; Kingma & Dhariwal , 2018 ) can be expressed as an implicit function in the form F ( z , x ) = f ( x ) − z = 0 . While ImpFlows are a powerful family to explore , generally they are not guaranteed to satisfy the invertibility and the tractability of the log-determinant as required by NFs . In this paper , we focus on the following specific form , which achieves a good balance between expressiveness and tractability , and leave other possibilities for future studies . Definition 1 . Let gz : Rd → Rd and gx : Rd → Rd be two functions such that Lip ( gx ) < 1 and Lip ( gz ) < 1 , where Lip ( g ) is the Lipschitz constant of a function g. A specific form of ImpFlows is defined by F ( z , x ) = 0 , where F ( z , x ) = gx ( x ) − gz ( z ) + x− z . ( 3 ) The root pairs of Eqn . ( 3 ) form a subset in Rd × Rd , which actually defines the assignment rule of a unique invertible function f . To see this , for any x0 , according to Definition 1 , we can construct a contraction hx0 ( z ) = F ( z , x0 ) + z with a unique fixed point , which corresponds to a unique root ( w.r.t . z ) of F ( z , x0 ) = 0 , denoted by f ( x0 ) . Similarly , in the reverse process , given a z0 , the root ( w.r.t . x ) of F ( z0 , x ) = 0 also exists and is unique , denoted by f−1 ( z0 ) . These two properties are sufficient to ensure the existence and the invertibility of f , as summarized in the following theorem . Theorem 1 . Eqn . ( 3 ) defines a unique mapping f : Rd → Rd , z = f ( x ) , and f is invertible . See proof in Appendix A.1 . Theorem 1 characterizes the validness of the ImpFlows introduced in Definition 1 . In fact , a single ImpFlow is a stack of a single ResFlow and the inverse of another single ResFlow , which will be formally stated in Sec 4 . We will investigate the expressiveness of the function family of the ImpFlows in Sec 4 , and present a scalable algorithm to learn a deep generative model built upon ImpFlows in Sec . 5 .
The authors concerns the question of how expressive invertible functions can be constructed. Their ansatz is the defining an invertible layer implicitly, using the root of an equation. While this approach is more general, they employ residual flows (ResFlows) to formulate a particular realisation of such an equation, calling the model ImpFlow. They show that the resulting function space is strictly richer than that of ResFlows. They further demonstrate how ImpFlows can be trained and evaluated. Empirically, ImpFlows outperform ResFlows on all considered tasks.
SP:b9d29e5258471d8fbd0b73e3bb05ed3cdfc68d6a
Implicit Normalizing Flows
1 INTRODUCTION . Normalizing flows ( NFs ) ( Rezende & Mohamed , 2015 ; Dinh et al. , 2014 ) are promising methods for density modeling . NFs define a model distribution px ( x ) by specifying an invertible transformation f ( x ) from x to another random variable z . By change-of-variable formula , the model density is ln px ( x ) = ln pz ( f ( x ) ) + ln |det ( Jf ( x ) ) | , ( 1 ) where pz ( z ) follows a simple distribution , such as Gaussian . NFs are particularly attractive due to their tractability , i.e. , the model density px ( x ) can be directly evaluated as Eqn . ( 1 ) . To achieve such tractability , NF models should satisfy two requirements : ( i ) the mapping between x and z is invertible ; ( ii ) the log-determinant of the Jacobian Jf ( x ) is tractable . Searching for rich model families that satisfy these tractability constraints is crucial for the advance of normalizing flow research . For the second requirement , earlier works such as inverse autoregressive flow ( Kingma et al. , 2016 ) and RealNVP ( Dinh et al. , 2017 ) restrict the model family to those with triangular Jacobian matrices . More recently , there emerge some free-form Jacobian approaches , such as Residual Flows ( ResFlows ) ( Behrmann et al. , 2019 ; Chen et al. , 2019 ) . They relax the triangular Jacobian constraint by utilizing a stochastic estimator of the log-determinant , enriching the model family . However , the Lipschitz constant of each transformation block is constrained for invertibility . In general , this is not preferable because mapping a simple prior distribution to a potentially complex data distribution may require a transformation with a very large Lipschitz constant ( See Fig . 3 for a 2D example ) . Moreover , all the aforementioned methods assume that there exists an explicit forward mapping z = f ( x ) . Bijections with explicit forward mapping only covers a fraction of the broad class of invertible functions suggested by the first requirement , which may limit the model capacity . In this paper , we propose implicit flows ( ImpFlows ) to generalize NFs , allowing the transformation to be implicitly defined by an equation F ( z , x ) = 0 . Given x ( or z ) , the other variable can be computed by an implicit root-finding procedure z = RootFind ( F ( · , x ) ) . An explicit mapping z = f ( x ) used in prior NFs can viewed as a special case of ImpFlows in the form of F ( z , x ) = f ( x ) − z = ∗Corresponding Author . 0 . To balance between expressiveness and tractability , we present a specific from of ImpFlows , where each block is the composition of a ResFlow block and the inverse of another ResFlow block . We theoretically study the model capacity of ResFlows and ImpFlows in the function space . We show that the function family of single-block ImpFlows is strictly richer than that of two-block ResFlows by relaxing the Lipschitz constraints . Furthermore , for any ResFlow with a fixed number of blocks , there exists some invertible function that ResFlow has non-negligible approximation error , but ImpFlow can exactly model . On the practical side , we develop a scalable algorithm to estimate the probability density and its gradients , and draw samples from ImpFlows . The algorithm leverages the implicit differentiation formula . Despite being more powerful , the gradient computation of ImpFlow is mostly similar with that of ResFlows , except some additional overhead on root finding . We test the effectiveness of ImpFlow on several classification and generative modeling tasks . ImpFlow outperforms ResFlow on all the benchmarks , with comparable model sizes and computational cost . 2 RELATED WORK . Expressive Normalizing Flows There are many works focusing on improving the capacity of NFs . For example , Dinh et al . ( 2014 ; 2017 ) ; Kingma & Dhariwal ( 2018 ) ; Ho et al . ( 2019 ) ; Song et al . ( 2019 ) ; Hoogeboom et al . ( 2019 ) ; De Cao et al . ( 2020 ) ; Durkan et al . ( 2019 ) design dedicated model architectures with tractable Jacobian . More recently , Grathwohl et al . ( 2019 ) ; Behrmann et al . ( 2019 ) ; Chen et al . ( 2019 ) propose NFs with free-form Jacobian , which approximate the determinant with stochastic estimators . In parallel with architecture design , Chen et al . ( 2020 ) ; Huang et al . ( 2020 ) ; Cornish et al . ( 2020 ) ; Nielsen et al . ( 2020 ) improve the capacity of NFs by operating in a higher-dimensional space . As mentioned in the introduction , all these existing works adopt explicit forward mappings , which is only a subset of the broad class of invertible functions . In contrast , the implicit function family we consider is richer . While we primarily discuss the implicit generalization of ResFlows ( Chen et al. , 2019 ) in this paper , the general idea of utilizing implicit invertible functions could be potentially applied to other models as well . Finally , Zhang et al . ( 2020 ) formally prove that the model capacity of ResFlows is restricted by the dimension of the residual blocks . In comparison , we study another limitation of ResFlows in terms of the bounded Lipschitz constant , and compare the function family of ResFlows and ImpFlows with a comparable depth . Continuous Time Flows ( CTFs ) ( Chen et al. , 2018b ; Grathwohl et al. , 2019 ; Chen et al. , 2018a ) are flexible alternative to discrete time flows for generative modeling . They typically treat the invertible transformation as a dynamical system , which is approximately simulated by ordinary differential equation ( ODE ) solvers . In contrast , the implicit function family considered in this paper does not contain differential equations , and only requires fixed point solvers . Moreover , the theoretical guarantee is different . While CTFs typically study the universal approximation capacity under the continuous time case ( i.e. , “ infinite depth ” limit ) , we consider the model capacity of ImpFlows and ResFlows under a finite number of transformation steps . Finally , while CTFs are flexible , their learning is challenging due to instability ( Liu et al. , 2020 ; Massaroli et al. , 2020 ) and exceedingly many ODE solver steps ( Finlay et al. , 2020 ) , making their large-scale application still an open problem . Implicit Deep Learning Utilizing implicit functions enhances the flexibility of neural networks , enabling the design of network layers in a problem-specific way . For instance , Bai et al . ( 2019 ) propose a deep equilibrium model as a compact replacement of recurrent networks ; Amos & Kolter ( 2017 ) generalize each layer to solve an optimization problem ; Wang et al . ( 2019 ) integrate logical reasoning into neural networks ; Reshniak & Webster ( 2019 ) utilize the implicit Euler method to improve the stability of both forward and backward processes for residual blocks ; and Sitzmann et al . ( 2020 ) incorporate periodic functions for representation learning . Different from these works , which consider implicit functions as a replacement to feed-forward networks , we develop invertible implicit functions for normalizing flows , discuss the conditions of the existence of such functions , and theoretically study the model capacity of our proposed ImpFlow in the function space . 3 IMPLICIT NORMALIZING FLOWS . We now present implicit normalizing flows , by starting with a brief overview of existing work . 3.1 NORMALIZING FLOWS . As shown in Eqn . ( 1 ) , a normalizing flow f : x 7→ z is an invertible function that defines a probability distribution with the change-of-variable formula . The modeling capacity of normalizing flows depends on the expressiveness of the invertible function f . Residual flows ( ResFlows ) ( Chen et al. , 2019 ; Behrmann et al. , 2019 ) are a particular powerful class of NFs due to their free-form Jacobian . ResFlows use f = fL ◦ · · · ◦ f1 to construct the invertible mapping , where each layer fl is an invertible residual network with Lipschitz constraints bounded by a fixed constant κ : fl ( x ) = x+ gl ( x ) , Lip ( gl ) ≤ κ < 1 , ( 2 ) where Lip ( g ) is the Lipschitz constant of a function g ( see Sec . 4.1 for details ) . Despite their free-form Jacobian , the model capacity of ResFlows is still limited by the Lipschitz constant of the invertible function . The Lipschitz constant of each ResFlow block fl can not exceed 2 ( Behrmann et al. , 2019 ) , so the Lipschitz constant of an L-block ResFlow can not exceed 2L . However , to transfer a simple prior distribution to a potentially complex data distribution , the Lipschitz constant of the transformation can be required to be sufficiently large in general . Therefore , ResFlows can be undesirably deep simply to meet the Lipschitz constraints ( see Fig . 3 for a 2D example ) . Below , we present implicit flows ( ImpFlows ) to relax the Lipschitz constraints . 3.2 MODEL SPECIFICATION . In general , an implicit flow ( ImpFlow ) is defined as an invertible mapping between random variables x and z of dimension d by finding the roots of F ( z , x ) = 0 , where F is a function from R2d to Rd . In particular , the explicit mappings z = f ( x ) used in prior flow instances ( Chen et al. , 2019 ; Kingma & Dhariwal , 2018 ) can be expressed as an implicit function in the form F ( z , x ) = f ( x ) − z = 0 . While ImpFlows are a powerful family to explore , generally they are not guaranteed to satisfy the invertibility and the tractability of the log-determinant as required by NFs . In this paper , we focus on the following specific form , which achieves a good balance between expressiveness and tractability , and leave other possibilities for future studies . Definition 1 . Let gz : Rd → Rd and gx : Rd → Rd be two functions such that Lip ( gx ) < 1 and Lip ( gz ) < 1 , where Lip ( g ) is the Lipschitz constant of a function g. A specific form of ImpFlows is defined by F ( z , x ) = 0 , where F ( z , x ) = gx ( x ) − gz ( z ) + x− z . ( 3 ) The root pairs of Eqn . ( 3 ) form a subset in Rd × Rd , which actually defines the assignment rule of a unique invertible function f . To see this , for any x0 , according to Definition 1 , we can construct a contraction hx0 ( z ) = F ( z , x0 ) + z with a unique fixed point , which corresponds to a unique root ( w.r.t . z ) of F ( z , x0 ) = 0 , denoted by f ( x0 ) . Similarly , in the reverse process , given a z0 , the root ( w.r.t . x ) of F ( z0 , x ) = 0 also exists and is unique , denoted by f−1 ( z0 ) . These two properties are sufficient to ensure the existence and the invertibility of f , as summarized in the following theorem . Theorem 1 . Eqn . ( 3 ) defines a unique mapping f : Rd → Rd , z = f ( x ) , and f is invertible . See proof in Appendix A.1 . Theorem 1 characterizes the validness of the ImpFlows introduced in Definition 1 . In fact , a single ImpFlow is a stack of a single ResFlow and the inverse of another single ResFlow , which will be formally stated in Sec 4 . We will investigate the expressiveness of the function family of the ImpFlows in Sec 4 , and present a scalable algorithm to learn a deep generative model built upon ImpFlows in Sec . 5 .
This work is about a new architecture for normalizing flows inspired by implicit neural networks. In particular, the authors show that a specific implicit neural network build from residual blocks defines a bijective map. From this insight, they show how to efficiently train such architecture by estimating the log Jacobian and solving the inverse problem related to the implicit architecture. On top of this achievement, the authors thoroughly study the attractiveness of their architecture compared to i-res-flow. They demonstrate analytically and empirically that implicit normalizing flows are strictly more expressive than i-res-flow.
SP:b9d29e5258471d8fbd0b73e3bb05ed3cdfc68d6a
Learning A Minimax Optimizer: A Pilot Study
1 INTRODUCTION . Many popular applications can be formulated into solving continuous minimax optimization , such as generative adversarial networks ( GAN ) ( Goodfellow et al. , 2014 ) , distributionally robust learning ( Globerson & Roweis , 2006 ) , domain adaptation ( Ganin & Lempitsky , 2014 ) , distributed computing ( Shamma , 2008 ; Mateos et al. , 2010 ) , privacy protection ( Wu et al. , 2018 ; 2020 ) , among many more . This paper studies such problems : we consider a cost function f : Rm × Rn → R and the min-max game minxmaxy f ( x , y ) . We aim to find the saddle point ( x∗ , y∗ ) of f : f ( x∗ , y ) ≤ f ( x∗ , y∗ ) ≤ f ( x , y∗ ) , ∀ ( x , y ) ∈ X × Y , ( 1 ) where X ⊂ Rm and Y ⊂ Rn . If X = Rm and Y = Rn , ( x∗ , y∗ ) is called a global saddle point ; if X × Y is a neighborhood near ( x∗ , y∗ ) , ( x∗ , y∗ ) is a local saddle point . The main challenge to solve problem ( 1 ) is the unstable dynamics of iterative algorithms . Simplest algorithms such as gradient descent ascent ( GDA ) can cycle around the saddle point or even diverge ( Benaım & Hirsch , 1999 ; Mertikopoulos et al. , 2018b ; Lin et al. , 2019 ) . Plenty of works have been developed recently to address this issue ( Daskalakis et al. , 2018 ; Daskalakis & Panageas , 2018 ; Liang & Stokes , 2019 ; Mertikopoulos et al. , 2018a ; Gidel et al. , 2018 ; Mokhtari et al. , 2019 ) . However , the convergence is still sensitive to the parameters in these algorithms . Even if the cost function is only changed by scaling , those parameters have to be re-tuned to ensure convergence . A recent trend of learning to optimize ( L2O ) parameterizes training algorithms to be learnable from data , such that the meta-learned optimizers can be adapted to a special class of functions and outperform general-purpose optimizers . That is particularly meaningful , when one has to solve a large number of yet similar optimization problems repeatedly and quickly . Specifically , for existing L2O methods that operate in the space of continuous optimization , almost all of them solve some ∗Equal Contribution . 1 minimization problem ( Andrychowicz et al. , 2016 ; Chen et al. , 2017 ; Li & Malik , 2016 ) , leveraging an LSTM or a reinforcement learner to model their optimizer . Different from classic optimization results that often provide worst-case convergence , most L2O methods have little or no convergence guarantees , especially on problem or data instances distinct from what is seen in training , leaving their generalizability in practice questionable ( Heaton et al. , 2020 ) . Motivated by L2O ’ s success in learning efficient minimization solvers from data , this paper seeks to answer : whether we could accomplish strong minimax L2O solvers as well ; and if yes , how generalizable they could be ? As it might look straightforward at first glance , such extension is highly nontrivial due to facing several unique challenges . Firstly , while continuous minimization has a magnitude of mature and empirically stable solvers , for general minimax optimization , even state-of-the-art analytical algorithms can exhibit instability or even divergence . To the best of our knowledge , most state-of-theart convergence analysis of minimax optimization is built on the convex-concave assumption ( Gidel et al. , 2018 ; Mokhtari et al. , 2019 ; Ryu et al. , 2019 ) , and some recent works relax the assumption to nonconvex-concave ( Lin et al. , 2019 ; 2020 ) . Convergence for general minimax problems is still open . That makes a prominent concern on whether a stable minimax L2O is feasible . Secondly , given the two groups of min and max variables simultaneously , it is unclear to what extent their optimization strategies can be modeled and interact within one unified framework – a new question that would never be met in minimization . Thirdly , the noisy and sometimes cyclic dynamics of minimax optimization will provide noisier guidance ( e.g. , reward ) to L2O ; not to say that , it is not immediately clear how to define the reward : for minimization , the reward is typically defined as the negative cumulative objective values along the history ( Li & Malik , 2016 ) . However , for minimax optimization the objective can not simply be decreased or increased monotonically . Contribution : This paper is a pilot study into minimax L2O . We start by establishing the first dedicated minimax L2O framework , called Twin-L2O . It is composed of two LSTMs sharing one objective-based reward , separately responsible for updating min and max variables . By ablations of the design options , we find this decoupled design facilitate meta-learning most , particularly when the min and max updates are highly non-symmetric . We demonstrate the superior convergence of Twin-L2O on several testbed problems , compared against a number of analytical solvers . On top of that , we further investigate how to enhance the generalizability of the learned minimax solver1 , and discuss two complementary alternatives with experimental validations . The first alternative is an empirical toolkit that is applicable for general minimax L2O . We introduce curriculum learning to training L2O models for the first time , by recognizing that not all problem instances are the same difficult to learn to solve . After plugging in that idea , we show that Twin-L2O can be trained to stably solve a magnitude more problem instances ( in terms of parameter varying range ) . The second alternative explores a theoretical mechanism called safeguarding , particularly for the important special case of convex-concave problems . When solving a testing instance , safeguarding identifies when an L2O failure would occur and provides an analytical fall-back option ( Diakonikolas , 2020 ) . That guarantees convergence for convex-concave problems and , in practice , converges faster even when the problem parameters are drawn from a different distribution from training . 2 RELATED WORK . 2.1 MINIMAX OPTIMIZATION . Following ( Neumann , 1928 ) , the problem ( 1 ) has been studied for decades due to its wide applicability . Simultaneous gradient descent ( SimGD ) or gradient descent ascent ( GDA ) ( Nedić & Ozdaglar , 2009 ; Du & Hu , 2019 ; Jin et al. , 2019 ; Lin et al. , 2019 ) is one of the simplest minimax algorithms , conducting gradient descent over variable x and gradient ascent over variable y . However , the dynamics of SimGD or GDA can converge to limit cycles or even diverge ( Benaım & Hirsch , 1999 ; Mertikopoulos et al. , 2018b ; Lin et al. , 2019 ) . To address this issue , Optimistic gradient descent ascent ( OGDA ) simply modifies the dynamics of GDA and shows more stable performance ( Daskalakis et al. , 2018 ; Daskalakis & Panageas , 2018 ; Liang & Stokes , 2019 ; Mertikopoulos et al. , 2018a ; Gidel et al. , 2018 ; Mokhtari et al. , 2019 ) . OGDA attracts more attention because of its empirical success in training GANs . ( Ryu et al. , 2019 ) theoretically studies OGDA by analyzing its continuous time dynamic and 1We differentiate the usages of two terms : parameters and variables , throughout the paper . For example , minu maxv ax 2 − by2 , we call a , b parameters and x , y variables . For simplicity , this paper only discusses the L2O generalizability when the testing instances ’ parameter distribution differs from the training . 2 proposes Anchored simultaneous gradient descent that shows good performance . Follow-the-Ridge ( Wang et al. , 2019 ) also addresses the limit cycling problem by introducing second-order information into the dynamic of GDA . Lately , K-Beam ( Hamm & Noh , 2018 ) stabilizes the convergence of GDA by duplicating variable y , yielding strong performance . At each iteration , it performs gradient ascent independently on K copies of y and greedily chooses the copy that leads to a large function value f , then it updates x based on the selected copies . 2.2 LEARNING TO OPTIMIZE . As a special instance of meta-learning , L2O has been studied in multiple contexts , with continuous optimization being one of its main playgrounds so far . The first L2O framework is introduced in ( Andrychowicz et al. , 2016 ) , where both the optimizee ’ s gradients and loss function values are formulated as the input features for an RNN optimizer . Due to the enormous number of parameters , a coordinate-wise design of RNN optimizer is adopted , where all optimization coordinates share the same updating strategy . ( Li & Malik , 2016 ) uses the gradient history and objective values as observations and step vectors as actions in their reinforcement learning framework . ( Chen et al. , 2017 ) leverages RNN to train a meta-optimizer to optimize black-box functions . Two effective training tricks , random scaling and objective convexifying , are presented in ( Lv et al. , 2017 ) . Wichrowska et al . ( 2017 ) presents an optimizer of multi-level hierarchical RNN architecture augmented with additional architectural features . Li et al . ( 2020 ) introduces a Jacobian regularization to L2O and enhances the domain adaptation performance of optimizees . Chen et al . ( 2020a ) proposes several improved training techniques to stabilize L2O training and ameliorate performance . You et al . ( 2020 ) ; Chen et al . ( 2020b ; c ) extend the application scope of L2O into various practical problems such as graph neural network training , domain generalization , and noisy label training . The above works address continuous minimization problems using single optimizer models . One exception , ( Cao et al. , 2019 ) , extends L2O to solving Bayesian swarm optimization . The author presents a novel architecture where multiple LSTMs jointly learn iterative update formulas for the swarm of particles , coordinated by attention mechanisms . We also notice that two recent efforts ( Jiang et al. , 2018 ; Xiong & Hsieh , 2020 ) introduce L2O to adversarial training , a renowned application of minimax optimization . However , both of them merely utilize L2O to solve the inner minimization of their minimax problems ( i.e. , generating attacks ) , while the outer maximization is still solved analytically . Neither of the two directly solves the full minimax optimization . 3 METHOD . 3.1 MAIN FRAMEWORK : TWIN LEARNABLE OPTIMIZERS ( TWIN-L2O ) . The main L2O framework we proposed is named Twin-L2O , where we use two learnable optimizers to alternate between min and max updates . Our design adopts the basic idea of ( Andrychowicz et al. , 2016 ) to use Long Short-Term Memory ( LSTM ) to model learnable optimizers , for solving target problems known as optimizees . At each step , LSTM outputs the update of the optimizee variables . The LSTM inputs are typically the current zero-order or first-order information of the optimizee ( Andrychowicz et al. , 2016 ; Lee & Choi , 2018 ) , plus the historic optimization trajectory information . In Twin-L2O , two LSTMs separately update x and y and record historical trajectory information of their own variables respectively . Formally , we consider the minimax problem minxmaxy f ( x , y ) . We use two LSTM optimizers , LSTM-Min and LSTM-Max , to updates the min variable x and the max variable y respectively . LSTM-Min is parameterized by φmin and LSTM-Max is parameterized by φmax . At each iteration t , Twin-L2O updates x and y in turns and yields the following rule : xt+1 =xt + ∆xt , where ( ∆xt , hmint+1 ) = LSTM-Min ( [ ∇xf ( xt , yt ) , ∇yf ( xt , yt ) ] , hmint , φmin ) , yt+1 =yt + ∆yt , where ( ∆yt , hmaxt+1 ) = LSTM-Max ( [ ∇yf ( xt+1 , yt ) , ∇xf ( xt+1 , yt ) ] , hmaxt , φmax ) , ( 2 ) where hmint and h max t are the historical trajectory information of LSTM-Min and LSTM-Max at time step t. This formulation is inspired by the SimGD/GDA-style algorithms ( Nedić & Ozdaglar , 2009 ; Du & Hu , 2019 ; Jin et al. , 2019 ; Lin et al. , 2019 ) that conduct simultaneous/alternative gradient descent over x and ascent over y . Figure A4 ( Appendix A1 ) conceptually illustrates the framework . The next question is to design the L2O reward . To train the LSTM optimizers , the loss function is often to penalize some type of cost , accumulated along the optimization trajectory for a horizon of T 3 steps ( also known as the unrolling length for LSTM ( Sherstinsky , 2018 ) ) L ( φmin , φmax ) = Ef [ T∑ t=1 wtR ( f , xt , yt ) ] , ( 3 ) wt is chosen to be all 1 following the basic setting in ( Andrychowicz et al. , 2016 ) , that might be tuned for better performance in future work . As a key design option , R ( f ) represents the reward to guide the L2O training . In existing L2O methods for continuous minimization ( Andrychowicz et al. , 2016 ; Lv et al. , 2017 ) , R ( f ) is usually simply set to R ( f , xt ) ) = f ( xt ) to encourage fast decrease of objective values over time . To extend this existing reward to the minimax scenario , we can not directly penalize the overall objective function value either way , since the min and max objectives are entangled . Also , different from pure minimization problems , the Twin-L2O updates ( 2 ) consist of two alternating steps governed by two different LSTM optimizers : each accounts for its own subproblem goal ( min or max updates ) , but the two also have to collaborate to explore/exploit the minimax landscape . We specifically design the following reward that implicitly addresses the above issue by setting a new reward function : L ( φmin , φmax ) = Ef [ T∑ t=1 { [ f ( xt , yt−1 ) − f ( xt , yt ) ] + [ f ( xt , yt−1 ) − f ( xt−1 , yt−1 ) ] } ] . ( 4 ) Analysis of the reward design In Eqn . 4 , the first and second terms always characterize two consecutive min and max updates . In more details , the value of f ( xt , yt ) −f ( xt , yt−1 ) solely reflects how effectively the t-step max update increases the objective f , while f ( xt , yt−1 ) − f ( xt−1 , yt−1 ) reflects the effectiveness of t-step min update in decreasing the objective f . Our goal is then to maximize the weighted accumulated sum for f ( xt , yt ) −f ( xt , yt−1 ) , while minimizing the weighted accumulated sum for f ( xt , yt ) − f ( xt , yt−1 ) , t = 1 , 2 , ... , T . Combining the two sub-goals together ( with a sign change to turn max into min ) yields our reward . One may also alternatively interpret Eqn . 4 as penalizing the loss change from f ( xt , yt ) along both x and y updating directions , which would encourage yielding stationary points . For the reward design , we provide a more detailed discussion in Appendix A6 . Specifically , we provide a comparison between the objective-based reward in Eqn . 4 , and another possible gradientbased reward . The latter was found to be ineffective in solving the problems presented in Section 4 . Rationale of the framework selection Another important design question is to what extent learning the min and max updates should be ( dis ) entangled : on the one hand , the two steps obviously interact with each other as they jointly explore the minimax landscape ; on the other hand , min and max steps commonly have asymmetric difficulty levels , that have been leveraged by previous algorithms . For example , ( Hamm & Noh , 2018 ) demonstrates the failure of alternating gradient descent in minimax optimization due to the multiple solution discontinuity of the inner maximization , and addresses that by simultaneously tracking K candidate solutions for the max step , while the outer minimization remains to take one descent step . Besides the joint reward ( 4 ) , the default Twin-L2O design leverages two independent LSTMs in Eqn . ( 2 ) , each dedicatedly handling min or max updates . In comparison , we also consider two other more `` entangled '' ways : ( a ) fully entangling the two optimizers , i.e . using one LSTM to simultaneously generate min and max outputs ; ( b ) weakly entangling the two optimizers , by using two LSTMs sharing weights , yet allowing either to maintain its own temporal hidden states . Our ablation experiments ( see Section 4.1 ) find that the default decoupled design in Eqn . ( 2 ) seems to facilitate the L2O learning most .
The paper introduces the _learning to optimize_ (L2O) framework into the solution of minimax problems. The base model is composed of two decoupled LSTMs with a shared objective, with the two LSTMs being respectively responsible for the update of the min and max variables. On top of this, the authors further investigate two possible improvements. One consists in applying curriculum learning to improve the generalization capability of the solver while the other uses safeguarding to guarantee convergence in convex-concave problems.
SP:42ff146511e450b30afabdbb8396c6db640d05fa
Learning A Minimax Optimizer: A Pilot Study
1 INTRODUCTION . Many popular applications can be formulated into solving continuous minimax optimization , such as generative adversarial networks ( GAN ) ( Goodfellow et al. , 2014 ) , distributionally robust learning ( Globerson & Roweis , 2006 ) , domain adaptation ( Ganin & Lempitsky , 2014 ) , distributed computing ( Shamma , 2008 ; Mateos et al. , 2010 ) , privacy protection ( Wu et al. , 2018 ; 2020 ) , among many more . This paper studies such problems : we consider a cost function f : Rm × Rn → R and the min-max game minxmaxy f ( x , y ) . We aim to find the saddle point ( x∗ , y∗ ) of f : f ( x∗ , y ) ≤ f ( x∗ , y∗ ) ≤ f ( x , y∗ ) , ∀ ( x , y ) ∈ X × Y , ( 1 ) where X ⊂ Rm and Y ⊂ Rn . If X = Rm and Y = Rn , ( x∗ , y∗ ) is called a global saddle point ; if X × Y is a neighborhood near ( x∗ , y∗ ) , ( x∗ , y∗ ) is a local saddle point . The main challenge to solve problem ( 1 ) is the unstable dynamics of iterative algorithms . Simplest algorithms such as gradient descent ascent ( GDA ) can cycle around the saddle point or even diverge ( Benaım & Hirsch , 1999 ; Mertikopoulos et al. , 2018b ; Lin et al. , 2019 ) . Plenty of works have been developed recently to address this issue ( Daskalakis et al. , 2018 ; Daskalakis & Panageas , 2018 ; Liang & Stokes , 2019 ; Mertikopoulos et al. , 2018a ; Gidel et al. , 2018 ; Mokhtari et al. , 2019 ) . However , the convergence is still sensitive to the parameters in these algorithms . Even if the cost function is only changed by scaling , those parameters have to be re-tuned to ensure convergence . A recent trend of learning to optimize ( L2O ) parameterizes training algorithms to be learnable from data , such that the meta-learned optimizers can be adapted to a special class of functions and outperform general-purpose optimizers . That is particularly meaningful , when one has to solve a large number of yet similar optimization problems repeatedly and quickly . Specifically , for existing L2O methods that operate in the space of continuous optimization , almost all of them solve some ∗Equal Contribution . 1 minimization problem ( Andrychowicz et al. , 2016 ; Chen et al. , 2017 ; Li & Malik , 2016 ) , leveraging an LSTM or a reinforcement learner to model their optimizer . Different from classic optimization results that often provide worst-case convergence , most L2O methods have little or no convergence guarantees , especially on problem or data instances distinct from what is seen in training , leaving their generalizability in practice questionable ( Heaton et al. , 2020 ) . Motivated by L2O ’ s success in learning efficient minimization solvers from data , this paper seeks to answer : whether we could accomplish strong minimax L2O solvers as well ; and if yes , how generalizable they could be ? As it might look straightforward at first glance , such extension is highly nontrivial due to facing several unique challenges . Firstly , while continuous minimization has a magnitude of mature and empirically stable solvers , for general minimax optimization , even state-of-the-art analytical algorithms can exhibit instability or even divergence . To the best of our knowledge , most state-of-theart convergence analysis of minimax optimization is built on the convex-concave assumption ( Gidel et al. , 2018 ; Mokhtari et al. , 2019 ; Ryu et al. , 2019 ) , and some recent works relax the assumption to nonconvex-concave ( Lin et al. , 2019 ; 2020 ) . Convergence for general minimax problems is still open . That makes a prominent concern on whether a stable minimax L2O is feasible . Secondly , given the two groups of min and max variables simultaneously , it is unclear to what extent their optimization strategies can be modeled and interact within one unified framework – a new question that would never be met in minimization . Thirdly , the noisy and sometimes cyclic dynamics of minimax optimization will provide noisier guidance ( e.g. , reward ) to L2O ; not to say that , it is not immediately clear how to define the reward : for minimization , the reward is typically defined as the negative cumulative objective values along the history ( Li & Malik , 2016 ) . However , for minimax optimization the objective can not simply be decreased or increased monotonically . Contribution : This paper is a pilot study into minimax L2O . We start by establishing the first dedicated minimax L2O framework , called Twin-L2O . It is composed of two LSTMs sharing one objective-based reward , separately responsible for updating min and max variables . By ablations of the design options , we find this decoupled design facilitate meta-learning most , particularly when the min and max updates are highly non-symmetric . We demonstrate the superior convergence of Twin-L2O on several testbed problems , compared against a number of analytical solvers . On top of that , we further investigate how to enhance the generalizability of the learned minimax solver1 , and discuss two complementary alternatives with experimental validations . The first alternative is an empirical toolkit that is applicable for general minimax L2O . We introduce curriculum learning to training L2O models for the first time , by recognizing that not all problem instances are the same difficult to learn to solve . After plugging in that idea , we show that Twin-L2O can be trained to stably solve a magnitude more problem instances ( in terms of parameter varying range ) . The second alternative explores a theoretical mechanism called safeguarding , particularly for the important special case of convex-concave problems . When solving a testing instance , safeguarding identifies when an L2O failure would occur and provides an analytical fall-back option ( Diakonikolas , 2020 ) . That guarantees convergence for convex-concave problems and , in practice , converges faster even when the problem parameters are drawn from a different distribution from training . 2 RELATED WORK . 2.1 MINIMAX OPTIMIZATION . Following ( Neumann , 1928 ) , the problem ( 1 ) has been studied for decades due to its wide applicability . Simultaneous gradient descent ( SimGD ) or gradient descent ascent ( GDA ) ( Nedić & Ozdaglar , 2009 ; Du & Hu , 2019 ; Jin et al. , 2019 ; Lin et al. , 2019 ) is one of the simplest minimax algorithms , conducting gradient descent over variable x and gradient ascent over variable y . However , the dynamics of SimGD or GDA can converge to limit cycles or even diverge ( Benaım & Hirsch , 1999 ; Mertikopoulos et al. , 2018b ; Lin et al. , 2019 ) . To address this issue , Optimistic gradient descent ascent ( OGDA ) simply modifies the dynamics of GDA and shows more stable performance ( Daskalakis et al. , 2018 ; Daskalakis & Panageas , 2018 ; Liang & Stokes , 2019 ; Mertikopoulos et al. , 2018a ; Gidel et al. , 2018 ; Mokhtari et al. , 2019 ) . OGDA attracts more attention because of its empirical success in training GANs . ( Ryu et al. , 2019 ) theoretically studies OGDA by analyzing its continuous time dynamic and 1We differentiate the usages of two terms : parameters and variables , throughout the paper . For example , minu maxv ax 2 − by2 , we call a , b parameters and x , y variables . For simplicity , this paper only discusses the L2O generalizability when the testing instances ’ parameter distribution differs from the training . 2 proposes Anchored simultaneous gradient descent that shows good performance . Follow-the-Ridge ( Wang et al. , 2019 ) also addresses the limit cycling problem by introducing second-order information into the dynamic of GDA . Lately , K-Beam ( Hamm & Noh , 2018 ) stabilizes the convergence of GDA by duplicating variable y , yielding strong performance . At each iteration , it performs gradient ascent independently on K copies of y and greedily chooses the copy that leads to a large function value f , then it updates x based on the selected copies . 2.2 LEARNING TO OPTIMIZE . As a special instance of meta-learning , L2O has been studied in multiple contexts , with continuous optimization being one of its main playgrounds so far . The first L2O framework is introduced in ( Andrychowicz et al. , 2016 ) , where both the optimizee ’ s gradients and loss function values are formulated as the input features for an RNN optimizer . Due to the enormous number of parameters , a coordinate-wise design of RNN optimizer is adopted , where all optimization coordinates share the same updating strategy . ( Li & Malik , 2016 ) uses the gradient history and objective values as observations and step vectors as actions in their reinforcement learning framework . ( Chen et al. , 2017 ) leverages RNN to train a meta-optimizer to optimize black-box functions . Two effective training tricks , random scaling and objective convexifying , are presented in ( Lv et al. , 2017 ) . Wichrowska et al . ( 2017 ) presents an optimizer of multi-level hierarchical RNN architecture augmented with additional architectural features . Li et al . ( 2020 ) introduces a Jacobian regularization to L2O and enhances the domain adaptation performance of optimizees . Chen et al . ( 2020a ) proposes several improved training techniques to stabilize L2O training and ameliorate performance . You et al . ( 2020 ) ; Chen et al . ( 2020b ; c ) extend the application scope of L2O into various practical problems such as graph neural network training , domain generalization , and noisy label training . The above works address continuous minimization problems using single optimizer models . One exception , ( Cao et al. , 2019 ) , extends L2O to solving Bayesian swarm optimization . The author presents a novel architecture where multiple LSTMs jointly learn iterative update formulas for the swarm of particles , coordinated by attention mechanisms . We also notice that two recent efforts ( Jiang et al. , 2018 ; Xiong & Hsieh , 2020 ) introduce L2O to adversarial training , a renowned application of minimax optimization . However , both of them merely utilize L2O to solve the inner minimization of their minimax problems ( i.e. , generating attacks ) , while the outer maximization is still solved analytically . Neither of the two directly solves the full minimax optimization . 3 METHOD . 3.1 MAIN FRAMEWORK : TWIN LEARNABLE OPTIMIZERS ( TWIN-L2O ) . The main L2O framework we proposed is named Twin-L2O , where we use two learnable optimizers to alternate between min and max updates . Our design adopts the basic idea of ( Andrychowicz et al. , 2016 ) to use Long Short-Term Memory ( LSTM ) to model learnable optimizers , for solving target problems known as optimizees . At each step , LSTM outputs the update of the optimizee variables . The LSTM inputs are typically the current zero-order or first-order information of the optimizee ( Andrychowicz et al. , 2016 ; Lee & Choi , 2018 ) , plus the historic optimization trajectory information . In Twin-L2O , two LSTMs separately update x and y and record historical trajectory information of their own variables respectively . Formally , we consider the minimax problem minxmaxy f ( x , y ) . We use two LSTM optimizers , LSTM-Min and LSTM-Max , to updates the min variable x and the max variable y respectively . LSTM-Min is parameterized by φmin and LSTM-Max is parameterized by φmax . At each iteration t , Twin-L2O updates x and y in turns and yields the following rule : xt+1 =xt + ∆xt , where ( ∆xt , hmint+1 ) = LSTM-Min ( [ ∇xf ( xt , yt ) , ∇yf ( xt , yt ) ] , hmint , φmin ) , yt+1 =yt + ∆yt , where ( ∆yt , hmaxt+1 ) = LSTM-Max ( [ ∇yf ( xt+1 , yt ) , ∇xf ( xt+1 , yt ) ] , hmaxt , φmax ) , ( 2 ) where hmint and h max t are the historical trajectory information of LSTM-Min and LSTM-Max at time step t. This formulation is inspired by the SimGD/GDA-style algorithms ( Nedić & Ozdaglar , 2009 ; Du & Hu , 2019 ; Jin et al. , 2019 ; Lin et al. , 2019 ) that conduct simultaneous/alternative gradient descent over x and ascent over y . Figure A4 ( Appendix A1 ) conceptually illustrates the framework . The next question is to design the L2O reward . To train the LSTM optimizers , the loss function is often to penalize some type of cost , accumulated along the optimization trajectory for a horizon of T 3 steps ( also known as the unrolling length for LSTM ( Sherstinsky , 2018 ) ) L ( φmin , φmax ) = Ef [ T∑ t=1 wtR ( f , xt , yt ) ] , ( 3 ) wt is chosen to be all 1 following the basic setting in ( Andrychowicz et al. , 2016 ) , that might be tuned for better performance in future work . As a key design option , R ( f ) represents the reward to guide the L2O training . In existing L2O methods for continuous minimization ( Andrychowicz et al. , 2016 ; Lv et al. , 2017 ) , R ( f ) is usually simply set to R ( f , xt ) ) = f ( xt ) to encourage fast decrease of objective values over time . To extend this existing reward to the minimax scenario , we can not directly penalize the overall objective function value either way , since the min and max objectives are entangled . Also , different from pure minimization problems , the Twin-L2O updates ( 2 ) consist of two alternating steps governed by two different LSTM optimizers : each accounts for its own subproblem goal ( min or max updates ) , but the two also have to collaborate to explore/exploit the minimax landscape . We specifically design the following reward that implicitly addresses the above issue by setting a new reward function : L ( φmin , φmax ) = Ef [ T∑ t=1 { [ f ( xt , yt−1 ) − f ( xt , yt ) ] + [ f ( xt , yt−1 ) − f ( xt−1 , yt−1 ) ] } ] . ( 4 ) Analysis of the reward design In Eqn . 4 , the first and second terms always characterize two consecutive min and max updates . In more details , the value of f ( xt , yt ) −f ( xt , yt−1 ) solely reflects how effectively the t-step max update increases the objective f , while f ( xt , yt−1 ) − f ( xt−1 , yt−1 ) reflects the effectiveness of t-step min update in decreasing the objective f . Our goal is then to maximize the weighted accumulated sum for f ( xt , yt ) −f ( xt , yt−1 ) , while minimizing the weighted accumulated sum for f ( xt , yt ) − f ( xt , yt−1 ) , t = 1 , 2 , ... , T . Combining the two sub-goals together ( with a sign change to turn max into min ) yields our reward . One may also alternatively interpret Eqn . 4 as penalizing the loss change from f ( xt , yt ) along both x and y updating directions , which would encourage yielding stationary points . For the reward design , we provide a more detailed discussion in Appendix A6 . Specifically , we provide a comparison between the objective-based reward in Eqn . 4 , and another possible gradientbased reward . The latter was found to be ineffective in solving the problems presented in Section 4 . Rationale of the framework selection Another important design question is to what extent learning the min and max updates should be ( dis ) entangled : on the one hand , the two steps obviously interact with each other as they jointly explore the minimax landscape ; on the other hand , min and max steps commonly have asymmetric difficulty levels , that have been leveraged by previous algorithms . For example , ( Hamm & Noh , 2018 ) demonstrates the failure of alternating gradient descent in minimax optimization due to the multiple solution discontinuity of the inner maximization , and addresses that by simultaneously tracking K candidate solutions for the max step , while the outer minimization remains to take one descent step . Besides the joint reward ( 4 ) , the default Twin-L2O design leverages two independent LSTMs in Eqn . ( 2 ) , each dedicatedly handling min or max updates . In comparison , we also consider two other more `` entangled '' ways : ( a ) fully entangling the two optimizers , i.e . using one LSTM to simultaneously generate min and max outputs ; ( b ) weakly entangling the two optimizers , by using two LSTMs sharing weights , yet allowing either to maintain its own temporal hidden states . Our ablation experiments ( see Section 4.1 ) find that the default decoupled design in Eqn . ( 2 ) seems to facilitate the L2O learning most .
Classical iterative minimax optimization algorithms display the unstable dynamics. Their convergence is often sensitive to the parameters and needs to be re-tuned for different problems to ensure convergence. Therefore, there is a practical motivation to develop L2O for minimax problems, so that we could meta-learn and adapt optimization rules to a special class of functions.
SP:42ff146511e450b30afabdbb8396c6db640d05fa
Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks
Deep neural networks ( DNNs ) are known vulnerable to backdoor attacks , a training time attack that injects a trigger pattern into a small proportion of training data so as to control the model ’ s prediction at the test time . Backdoor attacks are notably dangerous since they do not affect the model ’ s performance on clean examples , yet can fool the model to make incorrect prediction whenever the trigger pattern appears during testing . In this paper , we propose a novel defense framework Neural Attention Distillation ( NAD ) to erase backdoor triggers from backdoored DNNs . NAD utilizes a teacher network to guide the finetuning of the backdoored student network on a small clean subset of data such that the intermediate-layer attention of the student network aligns with that of the teacher network . The teacher network can be obtained by an independent finetuning process on the same clean subset . We empirically show , against 6 state-of-the-art backdoor attacks , NAD can effectively erase the backdoor triggers using only 5 % clean training data without causing obvious performance degradation on clean examples . Our code is available at https : //github.com/bboylyg/NAD . 1 INTRODUCTION . In recent years , deep neural networks ( DNNs ) have been widely adopted into many important realworld and safety-related applications . Nonetheless , it has been demonstrated that DNNs are prone to potential threats in multiple phases of their life cycles . A type of well-studied adversary is called the adversarial attack ( Szegedy et al. , 2013 ; Goodfellow et al. , 2014 ; Ma et al. , 2018 ; Jiang et al. , 2019 ; Wang et al. , 2019b ; 2020 ; Duan et al. , 2020 ; Ma et al. , 2020 ) . At test time , state-of-the-art DNN models can be fooled into making incorrect predictions with small adversarial perturbations ( Madry et al. , 2018 ; Carlini & Wagner , 2017 ; Wu et al. , 2020 ; Jiang et al. , 2020 ) . DNNs are also known to be vulnerable to another type of adversary known as the backdoor attack . Recently , backdoor attacks have gained more attention due to the fact it could be easily executed in real scenarios ( Gu et al. , 2019 ; Chen et al. , 2017 ) . Intuitively , backdoor attack aims to trick a model into learning a strong correlation between a trigger pattern and a target label by poisoning a small proportion of the training data . Even trigger patterns as simple as a single pixel ( Tran et al. , 2018 ) or a black-white checkerboard ( Gu et al. , 2019 ) can grant attackers full authority to control the model ’ s behavior . Backdoor attacks can be notoriously perilous for several reasons . First , backdoor data could infiltrate the model on numerous occasions including training models on data collected from unreliable sources or downloading pre-trained models from untrusted parties . Additionally , with the invention of more complex triggers such as natural reflections ( Liu et al. , 2020b ) or invisible noises ( Liao et al. , 2020 ; Li et al. , 2019 ; Chen et al. , 2019c ) , it is much harder to catch backdoor examples at test time . On top of that , once the backdoor triggers have been embedded into the target model , it is hard to completely eradicate their malicious effects by standard finetuning or neural pruning ( Yao et al. , 2019 ; Li et al. , 2020b ; Liu et al. , 2020b ) . A recent work also proposed the mode connectivity repair ( MCR ) to remove backdoor related neural paths from the network ( Zhao et al. , 2020a ) . On the other hand , even though detection-based approaches have been performing fairly well on identifying backdoored models ( Chen et al. , 2019a ; Tran et al. , 2018 ; Chen et al. , 2019b ; Kolouri et al. , 2020 ) , the identified backdoored models still need to be purified by backdoor erasing techniques . †Correspondence to : Xixiang Lyu ( xxlv @ mail.xidian.edu.cn ) , Xingjun Ma ( daniel.ma @ deakin.edu.au ) In this work , we propose a novel backdoor erasing approach , Neural Attention Distillation ( NAD ) , for the backdoor defense of DNNs . NAD is a distillation-guided finetuning process motivated by the ideas of knowledge distillation ( Bucilua et al. , 2006 ; Hinton et al. , 2014 ) and neural attention transfer ( Zagoruyko & Komodakis , 2017 ; Huang & Wang , 2017 ; Heo et al. , 2019 ) . Specifically , NAD utilizes a teacher network to guide the finetuning of a backdoored student network on a small subset of clean training data so that the intermediate-layer attention of the student network is wellaligned with that of the teacher network . The teacher network can be obtained from the backdoored student network via standard finetuning using the same clean subset of data . We empirically show that such an attention distillation step is far more effective in removing the network ’ s attention on the trigger pattern in comparison to the standard finetuning or the neural pruning methods . Our main contributions can be summarized as follows : • We propose a simple yet powerful backdoor defense approach called Neural Attention Distillation ( NAD ) . NAD is by far the most comprehensive and effective defense against a wide range of backdoor attacks . • We suggest that attention maps can be used as an intuitive way to evaluate the performance of backdoor defense mechanisms due to their ability to highlight backdoored regions in a network ’ s topology . 2 RELATED WORK . Backdoor Attack . Backdoor attack is a type of attack emerging in the training pipeline of DNNs . Oftentimes , a backdoor attack is accomplished by designing a trigger pattern with ( poisoned-label attack ) ( Gu et al. , 2019 ; Chen et al. , 2017 ; Liu et al. , 2018b ) or without ( clean-label attack ) ( Shafahi et al. , 2018 ; Turner et al. , 2019 ; Liu et al. , 2020b ) a target label injected into a subset of training data . These trigger patterns can appear in forms as simple as a single pixel ( Tran et al. , 2018 ) or a tiny patch ( Chen et al. , 2017 ) , or in more complex forms such as sinusoidal strips ( Barni et al. , 2019 ) and dynamic patterns ( Li et al. , 2020c ; Nguyen & Tran , 2020 ) . Trigger patterns may also appear in the form of natural reflection ( Liu et al. , 2020b ) or human imperceptible noise ( Liao et al. , 2020 ; Li et al. , 2019 ; Chen et al. , 2019c ) , making them more stealthy and hard to be detected even by human inspection . Recent studies have shown that a backdoor attack can be conducted even without access to the training data ( Liu et al. , 2018b ) or in federated learning ( Xie et al. , 2019 ; Bagdasaryan et al. , 2020 ; Lyu et al. , 2020 ) . Surveys on backdoor attacks can be found in ( Li et al. , 2020a ; Lyu et al. , 2020 ) . Backdoor Defense . Existing works primarily focused on two types of strategies to defend against backdoor attacks . Depending on the methodologies , a backdoor defense can be either backdoor detection or trigger erasing . Detection-based methods aim at identifying the existence of backdoor adversaries in the underlying model ( Wang et al. , 2019a ; Kolouri et al. , 2020 ) or filtering the suspicious samples from input data for re-training ( Tran et al. , 2018 ; Gao et al. , 2019 ; Chen et al. , 2019b ) . Although these methods have been performing fairly well on distinguishing whether a model has been poisoned , the backdoor effects still remain in the backdoored model . On the other hand , Erasing-based methods aim to directly purify the backdoored model by removing the malicious impacts caused by the backdoor triggers , while simultaneously maintain the model ’ s overall performance on clean data . A straightforward approach is to directly finetune the backdoored model on a small subset of clean data , which is typically available to the defender ( Liu et al. , 2018b ) . Nonetheless , training on only a small clean subset can lead to catastrophic forgetting ( Kirkpatrick et al. , 2017 ) , where the model overfits to the subset and consequently causes substantial performance degradation . Fine-pruning ( Liu et al. , 2018a ) alleviates this issue by pruning less informative neurons prior to finetuning the model . In such a way , the standard finetuning process can effectively erase the impact of backdoor triggers without significantly deteriorating the model ’ s overall performance . WILD ( Liu et al. , 2020a ) proposed to utilize data augmentation techniques alongside distribution alignment between clean samples and their occluded versions to remove backdoor triggers from DNNs . Other techniques such as regularization ( Truong et al. , 2020 ) and mode connectivity repair ( Zhao et al. , 2020a ) have also been explored to mitigate backdoor attacks . While promising , existing backdoor erasing methods still suffer from a number of drawbacks . Efficient methods can be evaded by the latest attacks ( Liu et al. , 2018a ; 2020b ) , whereas effective methods are typically computationally expensive ( Zhao et al. , 2020a ) . In this work , we propose a novel finetuning-based backdoor erasing approach that is not only effective but efficient against a wide range of backdoor attacks . Knowledge Distillation ( KD ) . KD was first proposed to compress a bigger or an ensemble of welltrained network ( s ) into a compact smaller network ( Bucilua et al. , 2006 ; Hinton et al. , 2014 ) . In this process , the more knowledgeable network is referred to as the teacher network , and the smaller network is the student network . Feature maps and attention mechanisms have been demonstrated to be very useful in KD to supervise the training of student networks ( Romero et al. , 2015 ; Zagoruyko & Komodakis , 2017 ; Huang & Wang , 2017 ; Song et al. , 2018 ; Ahn et al. , 2019 ; Heo et al. , 2019 ) . They can help the student network to learn more high-quality intermediate representations , leading to an improved distillation effect and better student network performance ( Romero et al. , 2015 ; Zagoruyko & Komodakis , 2017 ) . KD has also shown its potential in other fields such as adversarial robustness ( Papernot et al. , 2016 ) , multi-granularity lip reading ( Zhao et al. , 2020b ) , and data augmentation ( Bagherinezhad et al. , 2018 ) . In this work , we propose a new backdoor defense technique based on the combination of knowledge distillation and neural attention transfer . 3 PROPOSED APPROACH . In this section , we first describe the defense setting , then introduce the proposed NAD approach . Defense Setting . We adopt a typical defense setting where the defender outsourced a backdoored model from an untrusted party and is assumed to have a small subset of clean training data to finetune the model . The goals of backdoor erasing are to erase the backdoor trigger from the model while retaining the performance of the model on clean samples . 3.1 NEURAL ATTENTION DISTILLATION . Overview . We illustrate the differences between NAD and the traditional finetuning approach in Figure 1 . Instead of using the finetuned network directly as our final model , we employ it as a teacher network and use it in conjunction with the original backdoored network ( i.e . student network ) through an attention distillation process . The job of NAD is to align neurons that are more responsive to the trigger pattern with benign neurons that only responsible for meaningful representations . The main challenge for NAD is thus to find the proper attention representations to distill . Over the next few subsections , we will define the attention representation used throughout our work formally and introduce the loss functions used in the process of attention distillation . Attention Representation . Given a DNN model F , we denote the activation output at the l-th layer as F l ∈ RC×H×W with C , H andW being the dimensions of the channel , the height , and the width of the activation map respectively . We define A : RC×H×W → RH×W to be an attention operator that maps an activation map to an attention representation . Specifically , A takes a 3D activation map F as input and outputs a flattened 2D tensor along the channel dimension . We explore three possible formulations of the attention operator A as suggested in ( Zagoruyko & Komodakis , 2017 ) : Asum ( F l ) = C∑ i=1 ∣∣F li ∣∣ ; Apsum ( F l ) = C∑ i=1 ∣∣F li ∣∣p ; Apmean ( F l ) = 1C C∑ i=1 ∣∣F li ∣∣p , ( 1 ) where F li is the activation map of the i-th channel , | · | is the absolute value function and p > 1 . Intuitively , Asum reflects all activation regions including both the benign and the backdoored neurons . Apsum is a generalized version of Asum that amplifies the disparities between the backdoored neurons and the benign neurons by an order of p. In other words , the larger the p is , the more weight is placed on the parts with highest neuron activations . Amean aligns the activation center of the backdoored neurons with that of the benign neurons by taking the mean over all activation regions . An empirical understanding of the three attention representations is provided in the experiments . Attention Distillation Loss . A detailed structure of our NAD framework is illustrated in Figure 1 ( c ) . For ResNets ( He et al. , 2016 ) , we compute attention representations using one of the proposed attention functions after each group of residual blocks . The teacher network is kept fixed throughout the distillation process . The distillation loss at the l-th layer of the network is defined in terms of the teacher ’ s and the student ’ s attention maps : LNAD ( F lT , F l S ) = ∥∥∥∥∥ A ( F lT ) ∥∥A ( F lT ) ∥∥2 − A ( F l S ) ∥∥A ( F lS ) ∥∥2 ∥∥∥∥∥ 2 , ( 2 ) where ‖·‖2 is the L2 norm andA ( F lT ) /A ( F lS ) is the computed attention maps of the teacher/student network . It is worth mentioning that the normalization of the attention map is crucial to a successful distillation ( Zagoruyko & Komodakis , 2017 ) . Overall Training Loss . The overall training loss is a combination of the cross entropy ( CE ) loss and the sum of the Neural Attention Distillation ( NAD ) loss over all K residual groups : Ltotal = E ( x , y ) ∼D [ LCE ( FS ( x ) , y ) + β · K∑ l=1 LNAD ( F lT ( x ) , F lS ( x ) ) ] , ( 3 ) where LCE ( · ) measures the classification error of the student network , D is a subset of clean data used in finetuning , l is the index of the residual group , and β is a hyperparameter controlling the strength of the attention distillation . Before the attention distillation , a teacher network should be in place . We finetune the backdoored student network on the same clean subset D to obtain the teacher network . We will investigate how the choice of the teacher network affects the performance of NAD in Section 4.4 . We only distill the student network once as our NAD approach is effective enough to remove the backdoor by only a few epochs of distillation . A comprehensive analysis of iteratively applied NAD is also provided in the Appendix G .
The paper proposes a simple yet effective approach for purifying a neural network poisoned with backdoor attacks, AKA backdoor erasing. In short, the authors propose a two-step process: 1) fine-tuning the poisoned model on a small portion of clean data, which is a commonly used defense, and 2) treating the poisoned model as the student and the fine-tuned model as the teacher and performing attention distillation. The authors show the proposed approach's effectiveness by comparing to three commonly used techniques leveraging six state-of-the-art backdoor attacks on two datasets, namely GTSRB and CIFAR10.
SP:c26255b9b2de0df893e12a6cf5e61ffc46640418
Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks
Deep neural networks ( DNNs ) are known vulnerable to backdoor attacks , a training time attack that injects a trigger pattern into a small proportion of training data so as to control the model ’ s prediction at the test time . Backdoor attacks are notably dangerous since they do not affect the model ’ s performance on clean examples , yet can fool the model to make incorrect prediction whenever the trigger pattern appears during testing . In this paper , we propose a novel defense framework Neural Attention Distillation ( NAD ) to erase backdoor triggers from backdoored DNNs . NAD utilizes a teacher network to guide the finetuning of the backdoored student network on a small clean subset of data such that the intermediate-layer attention of the student network aligns with that of the teacher network . The teacher network can be obtained by an independent finetuning process on the same clean subset . We empirically show , against 6 state-of-the-art backdoor attacks , NAD can effectively erase the backdoor triggers using only 5 % clean training data without causing obvious performance degradation on clean examples . Our code is available at https : //github.com/bboylyg/NAD . 1 INTRODUCTION . In recent years , deep neural networks ( DNNs ) have been widely adopted into many important realworld and safety-related applications . Nonetheless , it has been demonstrated that DNNs are prone to potential threats in multiple phases of their life cycles . A type of well-studied adversary is called the adversarial attack ( Szegedy et al. , 2013 ; Goodfellow et al. , 2014 ; Ma et al. , 2018 ; Jiang et al. , 2019 ; Wang et al. , 2019b ; 2020 ; Duan et al. , 2020 ; Ma et al. , 2020 ) . At test time , state-of-the-art DNN models can be fooled into making incorrect predictions with small adversarial perturbations ( Madry et al. , 2018 ; Carlini & Wagner , 2017 ; Wu et al. , 2020 ; Jiang et al. , 2020 ) . DNNs are also known to be vulnerable to another type of adversary known as the backdoor attack . Recently , backdoor attacks have gained more attention due to the fact it could be easily executed in real scenarios ( Gu et al. , 2019 ; Chen et al. , 2017 ) . Intuitively , backdoor attack aims to trick a model into learning a strong correlation between a trigger pattern and a target label by poisoning a small proportion of the training data . Even trigger patterns as simple as a single pixel ( Tran et al. , 2018 ) or a black-white checkerboard ( Gu et al. , 2019 ) can grant attackers full authority to control the model ’ s behavior . Backdoor attacks can be notoriously perilous for several reasons . First , backdoor data could infiltrate the model on numerous occasions including training models on data collected from unreliable sources or downloading pre-trained models from untrusted parties . Additionally , with the invention of more complex triggers such as natural reflections ( Liu et al. , 2020b ) or invisible noises ( Liao et al. , 2020 ; Li et al. , 2019 ; Chen et al. , 2019c ) , it is much harder to catch backdoor examples at test time . On top of that , once the backdoor triggers have been embedded into the target model , it is hard to completely eradicate their malicious effects by standard finetuning or neural pruning ( Yao et al. , 2019 ; Li et al. , 2020b ; Liu et al. , 2020b ) . A recent work also proposed the mode connectivity repair ( MCR ) to remove backdoor related neural paths from the network ( Zhao et al. , 2020a ) . On the other hand , even though detection-based approaches have been performing fairly well on identifying backdoored models ( Chen et al. , 2019a ; Tran et al. , 2018 ; Chen et al. , 2019b ; Kolouri et al. , 2020 ) , the identified backdoored models still need to be purified by backdoor erasing techniques . †Correspondence to : Xixiang Lyu ( xxlv @ mail.xidian.edu.cn ) , Xingjun Ma ( daniel.ma @ deakin.edu.au ) In this work , we propose a novel backdoor erasing approach , Neural Attention Distillation ( NAD ) , for the backdoor defense of DNNs . NAD is a distillation-guided finetuning process motivated by the ideas of knowledge distillation ( Bucilua et al. , 2006 ; Hinton et al. , 2014 ) and neural attention transfer ( Zagoruyko & Komodakis , 2017 ; Huang & Wang , 2017 ; Heo et al. , 2019 ) . Specifically , NAD utilizes a teacher network to guide the finetuning of a backdoored student network on a small subset of clean training data so that the intermediate-layer attention of the student network is wellaligned with that of the teacher network . The teacher network can be obtained from the backdoored student network via standard finetuning using the same clean subset of data . We empirically show that such an attention distillation step is far more effective in removing the network ’ s attention on the trigger pattern in comparison to the standard finetuning or the neural pruning methods . Our main contributions can be summarized as follows : • We propose a simple yet powerful backdoor defense approach called Neural Attention Distillation ( NAD ) . NAD is by far the most comprehensive and effective defense against a wide range of backdoor attacks . • We suggest that attention maps can be used as an intuitive way to evaluate the performance of backdoor defense mechanisms due to their ability to highlight backdoored regions in a network ’ s topology . 2 RELATED WORK . Backdoor Attack . Backdoor attack is a type of attack emerging in the training pipeline of DNNs . Oftentimes , a backdoor attack is accomplished by designing a trigger pattern with ( poisoned-label attack ) ( Gu et al. , 2019 ; Chen et al. , 2017 ; Liu et al. , 2018b ) or without ( clean-label attack ) ( Shafahi et al. , 2018 ; Turner et al. , 2019 ; Liu et al. , 2020b ) a target label injected into a subset of training data . These trigger patterns can appear in forms as simple as a single pixel ( Tran et al. , 2018 ) or a tiny patch ( Chen et al. , 2017 ) , or in more complex forms such as sinusoidal strips ( Barni et al. , 2019 ) and dynamic patterns ( Li et al. , 2020c ; Nguyen & Tran , 2020 ) . Trigger patterns may also appear in the form of natural reflection ( Liu et al. , 2020b ) or human imperceptible noise ( Liao et al. , 2020 ; Li et al. , 2019 ; Chen et al. , 2019c ) , making them more stealthy and hard to be detected even by human inspection . Recent studies have shown that a backdoor attack can be conducted even without access to the training data ( Liu et al. , 2018b ) or in federated learning ( Xie et al. , 2019 ; Bagdasaryan et al. , 2020 ; Lyu et al. , 2020 ) . Surveys on backdoor attacks can be found in ( Li et al. , 2020a ; Lyu et al. , 2020 ) . Backdoor Defense . Existing works primarily focused on two types of strategies to defend against backdoor attacks . Depending on the methodologies , a backdoor defense can be either backdoor detection or trigger erasing . Detection-based methods aim at identifying the existence of backdoor adversaries in the underlying model ( Wang et al. , 2019a ; Kolouri et al. , 2020 ) or filtering the suspicious samples from input data for re-training ( Tran et al. , 2018 ; Gao et al. , 2019 ; Chen et al. , 2019b ) . Although these methods have been performing fairly well on distinguishing whether a model has been poisoned , the backdoor effects still remain in the backdoored model . On the other hand , Erasing-based methods aim to directly purify the backdoored model by removing the malicious impacts caused by the backdoor triggers , while simultaneously maintain the model ’ s overall performance on clean data . A straightforward approach is to directly finetune the backdoored model on a small subset of clean data , which is typically available to the defender ( Liu et al. , 2018b ) . Nonetheless , training on only a small clean subset can lead to catastrophic forgetting ( Kirkpatrick et al. , 2017 ) , where the model overfits to the subset and consequently causes substantial performance degradation . Fine-pruning ( Liu et al. , 2018a ) alleviates this issue by pruning less informative neurons prior to finetuning the model . In such a way , the standard finetuning process can effectively erase the impact of backdoor triggers without significantly deteriorating the model ’ s overall performance . WILD ( Liu et al. , 2020a ) proposed to utilize data augmentation techniques alongside distribution alignment between clean samples and their occluded versions to remove backdoor triggers from DNNs . Other techniques such as regularization ( Truong et al. , 2020 ) and mode connectivity repair ( Zhao et al. , 2020a ) have also been explored to mitigate backdoor attacks . While promising , existing backdoor erasing methods still suffer from a number of drawbacks . Efficient methods can be evaded by the latest attacks ( Liu et al. , 2018a ; 2020b ) , whereas effective methods are typically computationally expensive ( Zhao et al. , 2020a ) . In this work , we propose a novel finetuning-based backdoor erasing approach that is not only effective but efficient against a wide range of backdoor attacks . Knowledge Distillation ( KD ) . KD was first proposed to compress a bigger or an ensemble of welltrained network ( s ) into a compact smaller network ( Bucilua et al. , 2006 ; Hinton et al. , 2014 ) . In this process , the more knowledgeable network is referred to as the teacher network , and the smaller network is the student network . Feature maps and attention mechanisms have been demonstrated to be very useful in KD to supervise the training of student networks ( Romero et al. , 2015 ; Zagoruyko & Komodakis , 2017 ; Huang & Wang , 2017 ; Song et al. , 2018 ; Ahn et al. , 2019 ; Heo et al. , 2019 ) . They can help the student network to learn more high-quality intermediate representations , leading to an improved distillation effect and better student network performance ( Romero et al. , 2015 ; Zagoruyko & Komodakis , 2017 ) . KD has also shown its potential in other fields such as adversarial robustness ( Papernot et al. , 2016 ) , multi-granularity lip reading ( Zhao et al. , 2020b ) , and data augmentation ( Bagherinezhad et al. , 2018 ) . In this work , we propose a new backdoor defense technique based on the combination of knowledge distillation and neural attention transfer . 3 PROPOSED APPROACH . In this section , we first describe the defense setting , then introduce the proposed NAD approach . Defense Setting . We adopt a typical defense setting where the defender outsourced a backdoored model from an untrusted party and is assumed to have a small subset of clean training data to finetune the model . The goals of backdoor erasing are to erase the backdoor trigger from the model while retaining the performance of the model on clean samples . 3.1 NEURAL ATTENTION DISTILLATION . Overview . We illustrate the differences between NAD and the traditional finetuning approach in Figure 1 . Instead of using the finetuned network directly as our final model , we employ it as a teacher network and use it in conjunction with the original backdoored network ( i.e . student network ) through an attention distillation process . The job of NAD is to align neurons that are more responsive to the trigger pattern with benign neurons that only responsible for meaningful representations . The main challenge for NAD is thus to find the proper attention representations to distill . Over the next few subsections , we will define the attention representation used throughout our work formally and introduce the loss functions used in the process of attention distillation . Attention Representation . Given a DNN model F , we denote the activation output at the l-th layer as F l ∈ RC×H×W with C , H andW being the dimensions of the channel , the height , and the width of the activation map respectively . We define A : RC×H×W → RH×W to be an attention operator that maps an activation map to an attention representation . Specifically , A takes a 3D activation map F as input and outputs a flattened 2D tensor along the channel dimension . We explore three possible formulations of the attention operator A as suggested in ( Zagoruyko & Komodakis , 2017 ) : Asum ( F l ) = C∑ i=1 ∣∣F li ∣∣ ; Apsum ( F l ) = C∑ i=1 ∣∣F li ∣∣p ; Apmean ( F l ) = 1C C∑ i=1 ∣∣F li ∣∣p , ( 1 ) where F li is the activation map of the i-th channel , | · | is the absolute value function and p > 1 . Intuitively , Asum reflects all activation regions including both the benign and the backdoored neurons . Apsum is a generalized version of Asum that amplifies the disparities between the backdoored neurons and the benign neurons by an order of p. In other words , the larger the p is , the more weight is placed on the parts with highest neuron activations . Amean aligns the activation center of the backdoored neurons with that of the benign neurons by taking the mean over all activation regions . An empirical understanding of the three attention representations is provided in the experiments . Attention Distillation Loss . A detailed structure of our NAD framework is illustrated in Figure 1 ( c ) . For ResNets ( He et al. , 2016 ) , we compute attention representations using one of the proposed attention functions after each group of residual blocks . The teacher network is kept fixed throughout the distillation process . The distillation loss at the l-th layer of the network is defined in terms of the teacher ’ s and the student ’ s attention maps : LNAD ( F lT , F l S ) = ∥∥∥∥∥ A ( F lT ) ∥∥A ( F lT ) ∥∥2 − A ( F l S ) ∥∥A ( F lS ) ∥∥2 ∥∥∥∥∥ 2 , ( 2 ) where ‖·‖2 is the L2 norm andA ( F lT ) /A ( F lS ) is the computed attention maps of the teacher/student network . It is worth mentioning that the normalization of the attention map is crucial to a successful distillation ( Zagoruyko & Komodakis , 2017 ) . Overall Training Loss . The overall training loss is a combination of the cross entropy ( CE ) loss and the sum of the Neural Attention Distillation ( NAD ) loss over all K residual groups : Ltotal = E ( x , y ) ∼D [ LCE ( FS ( x ) , y ) + β · K∑ l=1 LNAD ( F lT ( x ) , F lS ( x ) ) ] , ( 3 ) where LCE ( · ) measures the classification error of the student network , D is a subset of clean data used in finetuning , l is the index of the residual group , and β is a hyperparameter controlling the strength of the attention distillation . Before the attention distillation , a teacher network should be in place . We finetune the backdoored student network on the same clean subset D to obtain the teacher network . We will investigate how the choice of the teacher network affects the performance of NAD in Section 4.4 . We only distill the student network once as our NAD approach is effective enough to remove the backdoor by only a few epochs of distillation . A comprehensive analysis of iteratively applied NAD is also provided in the Appendix G .
This paper proposes a novel approach to erase backdoor triggers from neural networks through distillation. The defense method, called neural attention distillation (NAD), first finetunes the backdoored model on a set of clean data to get a teacher model. The second part of NAD then finetunes another copy of the original backdoored model (student) on the same clean data while minimizing the difference between the activation maps of the student model and teacher model. The teacher model’s weights are frozen in this distillation phase. The authors show that NAD outperforms or matches previous backdoor defenses over a range of attacks on the CIFAR-10 and GTSRB datasets. Further experiments are also conducted to show NAD’s performance under different conditions such as the percentage of clean data and configuration of teacher-student models.
SP:c26255b9b2de0df893e12a6cf5e61ffc46640418
Human-Level Performance in No-Press Diplomacy via Equilibrium Search
1 INTRODUCTION . A primary goal for AI research is to develop agents that can act optimally in real-world multi-agent interactions ( i.e. , games ) . In recent years , AI agents have achieved expert-level or even superhuman performance in benchmark games such as backgammon ( Tesauro , 1994 ) , chess ( Campbell et al. , 2002 ) , Go ( Silver et al. , 2016 ; 2017 ; 2018 ) , poker ( Moravčík et al. , 2017 ; Brown & Sandholm , 2017 ; 2019b ) , and real-time strategy games ( Berner et al. , 2019 ; Vinyals et al. , 2019 ) . However , previous large-scale game AI results have focused on either purely competitive or purely cooperative settings . In contrast , real-world games , such as business negotiations , politics , and traffic navigation , involve a far more complex mixture of cooperation and competition . In such settings , the theoretical grounding for the techniques used in previous AI breakthroughs falls apart . In this paper we augment neural policies trained through imitation learning with regret minimization search techniques , and evaluate on the benchmark game of no-press Diplomacy . Diplomacy is a longstanding benchmark for research that features a rich mixture of cooperation and competition . Like previous researchers , we evaluate on the widely played no-press variant of Diplomacy , in which communication can only occur through the actions in the game ( i.e. , no cheap talk is allowed ) . Specifically , we begin with a blueprint policy that approximates human play in a dataset of Diplomacy games . We then improve upon the blueprint during play by approximating an equilibrium for the current phase of the game , assuming all players ( including our agent ) play the blueprint for the remainder of the game . Our agent then plays its part of the computed equilibrium . The equilibrium is computed via regret matching ( RM ) ( Blackwell et al. , 1956 ; Hart & Mas-Colell , 2000 ) . Search via RM has led to remarkable success in poker . However , RM only converges to a Nash equilibrium in two-player zero-sum games and other special cases , and RM was never previously shown to produce strong policies in a mixed cooperative/competitive game as complex as no-press Diplomacy . Nevertheless , we show that our agent exceeds the performance of prior agents and for the first time convincingly achieves human-level performance in no-press Diplomacy . Specifically , we show that our agent soundly defeats previous agents , that our agent is far less exploitable than previous agents , that an expert human can not exploit our agent even in repeated play , and , most ∗Equal Contribution . importantly , that our agent ranks in the top 2 % of human players when playing anonymous games on a popular Diplomacy website . 2 BACKGROUND AND RELATED WORK . Search has previously been used in almost every major game AI breakthrough , including backgammon ( Tesauro , 1994 ) , chess ( Campbell et al. , 2002 ) , Go ( Silver et al. , 2016 ; 2017 ; 2018 ) , poker ( Moravčík et al. , 2017 ; Brown & Sandholm , 2017 ; 2019b ) , and Hanabi ( Lerer et al. , 2020 ) . A major exception is real-time strategy games ( Vinyals et al. , 2019 ; Berner et al. , 2019 ) . Similar to SPARTA as used in Hanabi ( Lerer et al. , 2020 ) , our agent conducts one-ply lookahead search ( i.e. , changes the policy just for the current game turn ) and thereafter assumes all players play according to the blueprint . Similar to the Pluribus poker agent ( Brown & Sandholm , 2019b ) , our search technique uses regret matching to compute an approximate equilibrium . In a manner similar to the sampled best response algorithm of Anthony et al . ( 2020 ) , we sample a limited number of actions from the blueprint policy rather than search over all possible actions , which would be intractable . Learning effective policies in games involving cooperation and competition has been studied extensively in the field of multi-agent reinforcement learning ( MARL ) ( Shoham et al. , 2003 ) . Nash-Q and CE-Q applied Q learning for general sum games by using Q values derived by computing Nash ( or correlated ) equilibrium values at the target states ( Hu & Wellman , 2003 ; Greenwald et al. , 2003 ) . Friend-or-foe Q learning treats other agents as either cooperative or adversarial , where the Nash Q values are well defined Littman ( 2001 ) . The recent focus on “ deep ” MARL has led to learning rules from game theory such as fictitious play and regret minimization being adapted to deep reinforcement learning ( Heinrich & Silver , 2016 ; Brown et al. , 2019 ) , as well as work on game-theoretic challenges of mixed cooperative/competitive settings such as social dilemmas and multiple equilibria in the MARL setting ( Leibo et al. , 2017 ; Lerer & Peysakhovich , 2017 ; 2019 ) . Diplomacy in particular has served for decades as a benchmark for multi-agent AI research ( Kraus & Lehmann , 1988 ; Kraus et al. , 1994 ; Kraus & Lehmann , 1995 ; Johansson & Håård , 2005 ; Ferreira et al. , 2015 ) . Recently , Paquette et al . ( 2019 ) applied imitation learning ( IL ) via deep neural networks on a dataset of more than 150,000 Diplomacy games . This work greatly improved the state of the art for no-press Diplomacy , which was previously a handcrafted agent ( van Hal , 2013 ) . Paquette et al . ( 2019 ) also tested reinforcement learning ( RL ) in no-press Diplomacy via Advantage Actor-Critic ( A2C ) ( Mnih et al. , 2016 ) . Anthony et al . ( 2020 ) introduced sampled best response policy iteration , a self-play technique , which further improved upon the performance of Paquette et al . ( 2019 ) . 2.1 DESCRIPTION OF DIPLOMACY . The rules of no-press Diplomacy are complex ; a full description is provided by Paquette et al . ( 2019 ) . No-press Diplomacy is a seven-player zero-sum board game in which a map of Europe is divided into 75 provinces . 34 of these provinces contain supply centers ( SCs ) , and the goal of the game is for a player to control a majority ( 18 ) of the SCs . Each players begins the game controlling three or four SCs and an equal number of units . The game consists of three types of phases : movement phases in which each player assigns an order to each unit they control , retreat phases in which defeated units retreat to a neighboring province , and adjustment phases in which new units are built or existing units are destroyed . During a movement phase , a player assigns an order to each unit they control . A unit ’ s order may be to hold ( defend its province ) , move to a neighboring province , convoy a unit over water , or support a neighboring unit ’ s hold or move order . Support may be provided to units of any player . We refer to a tuple of orders , one order for each of a player ’ s units , as an action . That is , each player chooses one action each turn . There are an average of 26 valid orders for each unit ( Paquette et al. , 2019 ) , so the game ’ s branching factor is massive and on some turns enumerating all actions is intractable . Importantly , all actions occur simultaneously . In live games , players write down their orders and then reveal them at the same time . This makes Diplomacy an imperfect-information game in which an optimal policy may need to be stochastic in order to prevent predictability . Diplomacy is designed in such a way that cooperation with other players is almost essential in order to achieve victory , even though only one player can ultimately win . A game may end in a draw on any turn if all remaining players agree . Draws are a common outcome among experienced players because players will often coordinate to prevent any individual from reaching 18 centers . The two most common scoring systems for draws are draw-size scoring ( DSS ) , in which all surviving players equally split a win , and sum-of-squares scoring ( SoS ) , in which player i receives a score of C 2 i∑ j∈N C 2 j , where Ci is the number of SCs that player i controls ( Fogel , 2020 ) . Throughout this paper we use SoS scoring except in anonymous games against humans where the human host chooses a scoring system . 2.2 REGRET MATCHING . Regret Matching ( RM ) ( Blackwell et al. , 1956 ; Hart & Mas-Colell , 2000 ) is an iterative algorithm that converges to a Nash equilibrium ( NE ) ( Nash , 1951 ) in two-player zero-sum games and other special cases , and converges to a coarse correlated equilibrium ( CCE ) ( Hannan , 1957 ) in general . We consider a game with N players where each player i chooses an action ai from a set of actions Ai . We denote the joint action as a = ( a1 , a2 , . . . , aN ) , the actions of all players other than i as a−i , and the set of joint actions as A . After all players simultaneously choose an action , player i receives a reward of vi ( a ) ( which can also be represented as vi ( ai , a−i ) ) . Players may also choose a probability distribution over actions , where the probability of action ai is denoted πi ( ai ) and the vector of probabilities is denoted πi . Normally , each iteration of RM has a computational complexity of Πi∈N |Ai| . In a seven-player game , this is typically intractable . We therefore use a sampled form of RM in which each iteration has a computational complexity of ∑ i∈N |Ai| . We now describe this sampled form of RM . Each agent imaintains an external regret value for each action ai ∈ Ai , which we refer to simply as regret . The regret on iteration t is denoted Rti ( ai ) . Initially , all regrets are zero . On each iteration t of RM , πti ( ai ) is set according to πti ( ai ) = max { 0 , Rti ( ai ) } ∑ a′ i ∈Ai max { 0 , Rti ( a′i ) } if ∑ a′i∈Ai max { 0 , Rti ( a′i ) } > 0 1 |Ai| otherwise ( 1 ) Next , each player samples an action a∗i fromAi according to πti and all regrets are updated such that Rt+1i ( ai ) = R t i ( ai ) + vi ( ai , a ∗ −i ) − ∑ a′i∈Ai πti ( a ′ i ) vi ( a ′ i , a ∗ −i ) ( 2 ) This sampled form of RM guarantees that Rti ( ai ) ∈ O ( √ t ) with high probability ( Lanctot et al. , 2009 ) . If Rti ( ai ) grows sublinearly for all players ’ actions , as is the case in RM , then the average policy over all iterations converges to a NE in two-player zero-sum games and in general the empirical distribution of players ’ joint policies converges to a CCE as t→∞ . In order to improve empirical performance , we use linear RM ( Brown & Sandholm , 2019a ) , which weighs updates on iteration t by t.1 We also use optimism ( Syrgkanis et al. , 2015 ) , in which the most recent iteration is counted twice when computing regret . Additionally , the action our agent ultimately plays is sampled from the final iteration ’ s policy , rather than the average policy over all iterations . This reduces the risk of sampling a non-equilibrium action due to insufficient convergence . We explain this modification in more detail in Appendix F .
This paper proposes a combination of imitation learning and search applied to the multiplayer, simultaneous-move game of no-press Diplomacy. While both techniques have been used before, even in concert, there are some domain-specific challenges: more than two players, simultaneous moves, and a very large branching factor per player. The authors use imitation of human play for value estimates and selection of candidate actions, and External Regret Matching to generate a one-step policy. Experimental validation showed the agent to have strong human-level performance, and was hard to exploit using other machine-learning techniques.
SP:ea31c76a7f4c38f29544f50159cca36fa17d15f3
Human-Level Performance in No-Press Diplomacy via Equilibrium Search
1 INTRODUCTION . A primary goal for AI research is to develop agents that can act optimally in real-world multi-agent interactions ( i.e. , games ) . In recent years , AI agents have achieved expert-level or even superhuman performance in benchmark games such as backgammon ( Tesauro , 1994 ) , chess ( Campbell et al. , 2002 ) , Go ( Silver et al. , 2016 ; 2017 ; 2018 ) , poker ( Moravčík et al. , 2017 ; Brown & Sandholm , 2017 ; 2019b ) , and real-time strategy games ( Berner et al. , 2019 ; Vinyals et al. , 2019 ) . However , previous large-scale game AI results have focused on either purely competitive or purely cooperative settings . In contrast , real-world games , such as business negotiations , politics , and traffic navigation , involve a far more complex mixture of cooperation and competition . In such settings , the theoretical grounding for the techniques used in previous AI breakthroughs falls apart . In this paper we augment neural policies trained through imitation learning with regret minimization search techniques , and evaluate on the benchmark game of no-press Diplomacy . Diplomacy is a longstanding benchmark for research that features a rich mixture of cooperation and competition . Like previous researchers , we evaluate on the widely played no-press variant of Diplomacy , in which communication can only occur through the actions in the game ( i.e. , no cheap talk is allowed ) . Specifically , we begin with a blueprint policy that approximates human play in a dataset of Diplomacy games . We then improve upon the blueprint during play by approximating an equilibrium for the current phase of the game , assuming all players ( including our agent ) play the blueprint for the remainder of the game . Our agent then plays its part of the computed equilibrium . The equilibrium is computed via regret matching ( RM ) ( Blackwell et al. , 1956 ; Hart & Mas-Colell , 2000 ) . Search via RM has led to remarkable success in poker . However , RM only converges to a Nash equilibrium in two-player zero-sum games and other special cases , and RM was never previously shown to produce strong policies in a mixed cooperative/competitive game as complex as no-press Diplomacy . Nevertheless , we show that our agent exceeds the performance of prior agents and for the first time convincingly achieves human-level performance in no-press Diplomacy . Specifically , we show that our agent soundly defeats previous agents , that our agent is far less exploitable than previous agents , that an expert human can not exploit our agent even in repeated play , and , most ∗Equal Contribution . importantly , that our agent ranks in the top 2 % of human players when playing anonymous games on a popular Diplomacy website . 2 BACKGROUND AND RELATED WORK . Search has previously been used in almost every major game AI breakthrough , including backgammon ( Tesauro , 1994 ) , chess ( Campbell et al. , 2002 ) , Go ( Silver et al. , 2016 ; 2017 ; 2018 ) , poker ( Moravčík et al. , 2017 ; Brown & Sandholm , 2017 ; 2019b ) , and Hanabi ( Lerer et al. , 2020 ) . A major exception is real-time strategy games ( Vinyals et al. , 2019 ; Berner et al. , 2019 ) . Similar to SPARTA as used in Hanabi ( Lerer et al. , 2020 ) , our agent conducts one-ply lookahead search ( i.e. , changes the policy just for the current game turn ) and thereafter assumes all players play according to the blueprint . Similar to the Pluribus poker agent ( Brown & Sandholm , 2019b ) , our search technique uses regret matching to compute an approximate equilibrium . In a manner similar to the sampled best response algorithm of Anthony et al . ( 2020 ) , we sample a limited number of actions from the blueprint policy rather than search over all possible actions , which would be intractable . Learning effective policies in games involving cooperation and competition has been studied extensively in the field of multi-agent reinforcement learning ( MARL ) ( Shoham et al. , 2003 ) . Nash-Q and CE-Q applied Q learning for general sum games by using Q values derived by computing Nash ( or correlated ) equilibrium values at the target states ( Hu & Wellman , 2003 ; Greenwald et al. , 2003 ) . Friend-or-foe Q learning treats other agents as either cooperative or adversarial , where the Nash Q values are well defined Littman ( 2001 ) . The recent focus on “ deep ” MARL has led to learning rules from game theory such as fictitious play and regret minimization being adapted to deep reinforcement learning ( Heinrich & Silver , 2016 ; Brown et al. , 2019 ) , as well as work on game-theoretic challenges of mixed cooperative/competitive settings such as social dilemmas and multiple equilibria in the MARL setting ( Leibo et al. , 2017 ; Lerer & Peysakhovich , 2017 ; 2019 ) . Diplomacy in particular has served for decades as a benchmark for multi-agent AI research ( Kraus & Lehmann , 1988 ; Kraus et al. , 1994 ; Kraus & Lehmann , 1995 ; Johansson & Håård , 2005 ; Ferreira et al. , 2015 ) . Recently , Paquette et al . ( 2019 ) applied imitation learning ( IL ) via deep neural networks on a dataset of more than 150,000 Diplomacy games . This work greatly improved the state of the art for no-press Diplomacy , which was previously a handcrafted agent ( van Hal , 2013 ) . Paquette et al . ( 2019 ) also tested reinforcement learning ( RL ) in no-press Diplomacy via Advantage Actor-Critic ( A2C ) ( Mnih et al. , 2016 ) . Anthony et al . ( 2020 ) introduced sampled best response policy iteration , a self-play technique , which further improved upon the performance of Paquette et al . ( 2019 ) . 2.1 DESCRIPTION OF DIPLOMACY . The rules of no-press Diplomacy are complex ; a full description is provided by Paquette et al . ( 2019 ) . No-press Diplomacy is a seven-player zero-sum board game in which a map of Europe is divided into 75 provinces . 34 of these provinces contain supply centers ( SCs ) , and the goal of the game is for a player to control a majority ( 18 ) of the SCs . Each players begins the game controlling three or four SCs and an equal number of units . The game consists of three types of phases : movement phases in which each player assigns an order to each unit they control , retreat phases in which defeated units retreat to a neighboring province , and adjustment phases in which new units are built or existing units are destroyed . During a movement phase , a player assigns an order to each unit they control . A unit ’ s order may be to hold ( defend its province ) , move to a neighboring province , convoy a unit over water , or support a neighboring unit ’ s hold or move order . Support may be provided to units of any player . We refer to a tuple of orders , one order for each of a player ’ s units , as an action . That is , each player chooses one action each turn . There are an average of 26 valid orders for each unit ( Paquette et al. , 2019 ) , so the game ’ s branching factor is massive and on some turns enumerating all actions is intractable . Importantly , all actions occur simultaneously . In live games , players write down their orders and then reveal them at the same time . This makes Diplomacy an imperfect-information game in which an optimal policy may need to be stochastic in order to prevent predictability . Diplomacy is designed in such a way that cooperation with other players is almost essential in order to achieve victory , even though only one player can ultimately win . A game may end in a draw on any turn if all remaining players agree . Draws are a common outcome among experienced players because players will often coordinate to prevent any individual from reaching 18 centers . The two most common scoring systems for draws are draw-size scoring ( DSS ) , in which all surviving players equally split a win , and sum-of-squares scoring ( SoS ) , in which player i receives a score of C 2 i∑ j∈N C 2 j , where Ci is the number of SCs that player i controls ( Fogel , 2020 ) . Throughout this paper we use SoS scoring except in anonymous games against humans where the human host chooses a scoring system . 2.2 REGRET MATCHING . Regret Matching ( RM ) ( Blackwell et al. , 1956 ; Hart & Mas-Colell , 2000 ) is an iterative algorithm that converges to a Nash equilibrium ( NE ) ( Nash , 1951 ) in two-player zero-sum games and other special cases , and converges to a coarse correlated equilibrium ( CCE ) ( Hannan , 1957 ) in general . We consider a game with N players where each player i chooses an action ai from a set of actions Ai . We denote the joint action as a = ( a1 , a2 , . . . , aN ) , the actions of all players other than i as a−i , and the set of joint actions as A . After all players simultaneously choose an action , player i receives a reward of vi ( a ) ( which can also be represented as vi ( ai , a−i ) ) . Players may also choose a probability distribution over actions , where the probability of action ai is denoted πi ( ai ) and the vector of probabilities is denoted πi . Normally , each iteration of RM has a computational complexity of Πi∈N |Ai| . In a seven-player game , this is typically intractable . We therefore use a sampled form of RM in which each iteration has a computational complexity of ∑ i∈N |Ai| . We now describe this sampled form of RM . Each agent imaintains an external regret value for each action ai ∈ Ai , which we refer to simply as regret . The regret on iteration t is denoted Rti ( ai ) . Initially , all regrets are zero . On each iteration t of RM , πti ( ai ) is set according to πti ( ai ) = max { 0 , Rti ( ai ) } ∑ a′ i ∈Ai max { 0 , Rti ( a′i ) } if ∑ a′i∈Ai max { 0 , Rti ( a′i ) } > 0 1 |Ai| otherwise ( 1 ) Next , each player samples an action a∗i fromAi according to πti and all regrets are updated such that Rt+1i ( ai ) = R t i ( ai ) + vi ( ai , a ∗ −i ) − ∑ a′i∈Ai πti ( a ′ i ) vi ( a ′ i , a ∗ −i ) ( 2 ) This sampled form of RM guarantees that Rti ( ai ) ∈ O ( √ t ) with high probability ( Lanctot et al. , 2009 ) . If Rti ( ai ) grows sublinearly for all players ’ actions , as is the case in RM , then the average policy over all iterations converges to a NE in two-player zero-sum games and in general the empirical distribution of players ’ joint policies converges to a CCE as t→∞ . In order to improve empirical performance , we use linear RM ( Brown & Sandholm , 2019a ) , which weighs updates on iteration t by t.1 We also use optimism ( Syrgkanis et al. , 2015 ) , in which the most recent iteration is counted twice when computing regret . Additionally , the action our agent ultimately plays is sampled from the final iteration ’ s policy , rather than the average policy over all iterations . This reduces the risk of sampling a non-equilibrium action due to insufficient convergence . We explain this modification in more detail in Appendix F .
In this paper, the authors apply an interesting twist on 1-ply search to the problem of playing no-press Diplomacy. Diplomacy is an especially interesting application, because it is neither zero-sum nor two-player, in contrast to many recent AI success stories. Before each action, they compute an equilibrium of the next step of the game, assuming that each player will thereafter play according to a "blueprint" strategy learned via imitation learning. The equilibrium is computed using regret matching. The resulting agent has very strong performance against both the previous state of the art bots, and against expert human players.
SP:ea31c76a7f4c38f29544f50159cca36fa17d15f3
NAS-Bench-301 and the Case for Surrogate Benchmarks for Neural Architecture Search
1 INTRODUCTION . Neural Architecture Search ( NAS ) promises to advance representation learning by automatically finding architectures that facilitate the learning of strong representations for a given dataset . NAS has already achieved state-of-the-art performance on many tasks ( Real et al. , 2019 ; Liu et al. , 2019a ; Saikia et al. , 2019 ; Elsken et al. , 2020 ) and to create resource-aware architectures ( Tan et al. , 2018 ; Elsken et al. , 2019a ; Cai et al. , 2020 ) . For a review , we refer to Elsken et al . ( 2019b ) . Despite many advancements in terms of both efficiency and performance , empirical evaluations in NAS are still problematic . Different NAS papers often use different training pipelines , different search spaces and different hyperparameters , do not evaluate other methods under comparable settings , and can not afford enough runs for testing significance . This practice impedes assertions about the statistical significance of the reported results , recently brought into focus by several authors ( Yang et al. , 2019 ; Lindauer & Hutter , 2019 ; Shu et al. , 2020 ; Yu et al. , 2020 ) . To circumvent these issues and enable scientifically sound evaluations in NAS , several tabular benchmarks ( Ying et al. , 2019 ; Zela et al. , 2020b ; Dong & Yang , 2020 ; Klyuchnikov et al. , 2020 ) have been proposed recently ( see also Appendix A.1 for more details ) . However , all these benchmarks rely on an exhaustive evaluation of all architectures in a search space , which limits them to unrealistically small search spaces ( so far containing only between 6k and 423k architectures ) . This is a far shot from standard spaces used in the NAS literature , which contain more than 1018 architectures ( Zoph & Le , 2017 ; Liu et al. , 2019b ) . This discrepancy can cause results gained on existing tabular NAS benchmarks to not generalize to realistic search spaces ; e.g. , promising anytime results of local search on existing tabular NAS benchmarks were shown to not transfer to realistic search spaces ( White et al. , 2020b ) . To address these problems , we make the following contributions : 1 . We present NAS-Bench-301 , a surrogate NAS benchmark that is first to cover a realistically-sized search space ( namely the cell-based search space of DARTS ( Liu et al. , 2019b ) ) , containing more than 1018 possible architectures . This is made possible by estimating their performance via a surrogate model , removing the constraint to exhaustively evaluate the entire search space . 2 . We empirically demonstrate that a surrogate fitted on a subset of architectures can in fact model the true performance of architectures better than a tabular benchmark ( Section 2 ) . 3 . We analyze and release the NAS-Bench-301 training dataset consisting of∼60k fully trained and evaluated architectures , which will also be publicly available in the Open Graph Benchmark ( Hu et al. , 2020 ) ( Section 3 ) . 4 . Using this dataset , we thoroughly evaluate a variety of regression models as surrogate candidates , showing that strong generalization performance is possible even in large spaces ( Section 4 ) . 5 . We utilize NAS-Bench-301 as a benchmark for running various NAS optimizers and show that the resulting search trajectories closely resemble the ground truth trajectories . This enables sound simulations of thousands of GPU hours in a few seconds on a single CPU machine ( Section 5 ) . 6 . We demonstrate that NAS-Bench-301 can help in generating new scientific insights by studying a previous hypothesis on the performance of local search in the DARTS search space ( Section 6 ) . To foster reproducibility , we open-source all our code and data in a public repo : https : // anonymous.4open.science/r/3f99ef91-c472-4394-b666-5d464e099aca/ 2 MOTIVATION – CAN WE DO BETTER THAN A TABULAR BENCHMARK ? . We start by motivating the use of surrogate benchmarks by exposing an issue of tabular benchmarks that has largely gone unnoticed . Tabular benchmarks are built around a costly , exhaustive evaluation of all possible architectures in a search space , and when an architecture ’ s performance is queried , the tabular benchmark simply returns the respective table entry . The issue with this process is that the stochasticity of mini-batch training is also reflected in the performance of an architecture i , hence making it a random variable Yi . Therefore , the table only contains results of a few draws yi ∼ Yi ( existing NAS benchmarks feature up to 3 runs per architecture ) . Given the variance in these evaluations , a tabular benchmark acts as a simple estimator that assumes independent random variables , and thus estimates the performance of an architecture based only on previous evaluations of the same architecture . From a machine learning perspective , knowing that similar architectures tend to yield similar performance , and that the variance of individual evaluations can be high ( both shown to be the case by Ying et al . ( 2019 ) ) , it is natural to assume that better estimators may exist . In the remainder of this section , we empirically verify this hypothesis and show that surrogate benchmarks can provide better performance estimates than tabular benchmarks based on less data . Setup We choose NAS-Bench-101 ( Ying et al. , 2019 ) as a tabular benchmark for our analysis and a Graph Isomorphism Network ( GIN , Xu et al . ( 2019a ) ) as our surrogate model.1 Each architecture xi in NAS-Bench-101 contains 3 validation accuracies y1i , y 2 i , y 3 i from training xi with 3 different seeds . We excluded all diverged models with less than 50 % validation accuracy on any of the three evaluations in NAS-Bench-101 . We split this dataset to train the GIN surrogate model on one of the seeds , e.g. , Dtrain = { ( xi , y1i ) } i and evaluate on the other two , e.g. , Dtest = { ( xi , ȳ23i ) } i , where ȳ23i = ( y2i + y3i ) /2 . We emphasize that training a surrogate to model a search space is not a typical inductive regression task but rather a transductive one . By definition of the search space , the set of possible architectures is known ahead of time ( although it may be very large ) , hence a surrogate model does not have to generalize to out-ofdistribution data if the training data covers the space well . Results We compute the mean absolute error MAE = ∑ i |ŷi−ȳ 23 i | n of the surrogate model trained on Dtrain = { ( xi , y1i ) } i , where ŷi is predicted validation accuracy and n = |Dtest| . Table 1 shows that the surrogate model yields a lower MAE than the tabular benchmark , i.e . MAE = ∑ i |y 1 i−ȳ 23 i | n . We also report the mean squared error and Kendall tau correlation coefficient in Table 6 in the Appendix showing that the ranking between architectures is also predicted better by the surrogate . 1We used a GIN implementation by Errica et al . ( 2020 ) ; see Appendix B for details on training the GIN . We repeat the experiment in a cross-validation fashion w.r.t to the seeds and conclude : In contrast to a single tabular entry , the surrogate model learns to smooth out the noise.2 Next , we fit the GIN surrogate on subsets of Dtrain and plot how its performance scales with the amount of training data used in Figure 1 . The surrogate model performs better than the tabular benchmark when the training set has more than ∼21,500 architectures . Note that Dtest remains the same as in the previous experiment , i.e. , it includes all architectures in NAS-Bench-101 . As a result , we conclude that : A surrogate model can yield strong predictive performance when only a subset of the search space is available as training data . These empirical findings suggest that we can create reliable surrogate benchmarks for much larger and more realistic NAS spaces , which are infeasible to be exhaustively evaluated as done by tabular benchmarks . In the remainder of the paper , we focus on creating such a benchmark . 3 THE NAS-BENCH-301 DATASET We now describe the NAS-Bench-301 dataset which consists of ∼60k architectures and their performances on CIFAR-10 ( Krizhevsky , 2009 ) sampled from the most popular NAS cell search space : the one from DARTS ( Liu et al. , 2019b ) . We use this dataset not only to fit surrogate models but also to gain new insights , such as which regions of the architecture space are being explored by different NAS methods , or what the characteristics of architectures are that work well . 3.1 DATA COLLECTION . Since the DARTS search space ( detailed description in Appendix C.1 ) is far too large to be exhaustively evalu- ated , care has to be taken when sampling the architectures which will be used to train the surrogate models . Sampling should yield a good overall coverage of the architecture space while also providing a special focus on the well-performing regions that optimizers tend to exploit . Our principal methodology is inspired by Eggensperger et al . ( 2015 ) , who collected unbiased data about hyperparameter spaces by random search , as well as biased and dense samples in high-performance regions by running hyperparameter optimizers . This is desirable for a surrogate benchmark since we are interested in evaluating NAS methods that exploit such good regions of the space . Table 2 lists the NAS methods we used to collect such samples and the respective number of samples . Additionally , we evaluated ∼1k architectures in poorly-performing regions for better coverage and another ∼10k for the analysis conducted on the dataset and surrogates . We refer to Appendices C.2 and C.3 for details on the data collection and the optimizers , respectively . We would like to point out that in hindsight adding training data of well-performing regions may be less important for a surrogate NAS benchmark than for a surrogate HPO benchmark , which we demonstrated in Appendix E.3 . We argue that this is a result of HPO 2We do note that the average estimation error of tabular benchmarks could be reduced by a factor of √ k by performing k runs for each architecture . The error of a surrogate model would also shrink when the model is based on more data , but as k grows large tabular benchmarks would become competitive with surrogate models . search spaces containing many configurations which yield disfunctional models , which is less common for architectures in many NAS search spaces , hence allowing random search to give us good coverage of the space . In Figure 2 , we visualize the overall coverage of the search space as well as the similarity between sampled architectures using t-SNE ( van der Maaten & Hinton , 2008 ) . Besides showing a good overall coverage , some well-performing architectures in the search space form distinct clusters which are mostly located outside the main cloud of points . This clearly indicates that architectures with similar performance are close to each other in the architecture space . Additionally , we observe that different optimizers sample different types of architectures , see Figure 9 in the Appendix . 3.2 PERFORMANCE STATISTICS . Figure 3 shows the validation error on CIFAR-10 ( Krizhevsky , 2009 ) of all sampled architectures in relation to the model parameters and training runtime . Generally , as expected , models with more parameters are more costly to train but achieve lower validation errors . We also find that different NAS methods yield quite different performance distributions ( see Appendix C.4 for their individual performances ) . Validation and test errors are highly correlated with a Kendall tau rank correlation of τ = 0.852 ( Spearman rank corr . 0.969 ) , minimizing the risk of overfitting on the validation error . Furthermore , we find that cells of all depths can reach a good performance , but shallow topologies are slightly favored in our setting ( see Figure 10 in the Appendix ) . Also , a small number of parameter-free operations ( e.g. , skip connections ) can benefit the performance but featuring many of these significantly deteriorates performance . For the full analysis , see Appendix C.5 . Following standard practice in modern NAS papers ( e.g. , Liu et al . ( 2019b ) ) , we employ various data augmentation techniques during training for more reliable estimates of an architecture ’ s performance . For a description of our full training pipeline , please see Appendix C.6 .
This work filled an important gap in the NAS benchmarks. The previous benchmarks only contain small search space due to the expensive cost of evaluation of neural architecture. In this search space, random search often becomes competitive in the narrow search space. Thus, to provide meaningful comparison, this work provided a benchmark in a large NAS search space (same as in DARTS), and using surrogate models to predict validation performance of untrained neural architecture. The empirical results suggested using the surrogate benchmarks resulted in similar optimization trajectory as real evaluations and the author also shows one can derive/validate research ideas quickly with the benchmarks.
SP:59210764f21eadc8e69e720f9d12f3b85cf74ceb
NAS-Bench-301 and the Case for Surrogate Benchmarks for Neural Architecture Search
1 INTRODUCTION . Neural Architecture Search ( NAS ) promises to advance representation learning by automatically finding architectures that facilitate the learning of strong representations for a given dataset . NAS has already achieved state-of-the-art performance on many tasks ( Real et al. , 2019 ; Liu et al. , 2019a ; Saikia et al. , 2019 ; Elsken et al. , 2020 ) and to create resource-aware architectures ( Tan et al. , 2018 ; Elsken et al. , 2019a ; Cai et al. , 2020 ) . For a review , we refer to Elsken et al . ( 2019b ) . Despite many advancements in terms of both efficiency and performance , empirical evaluations in NAS are still problematic . Different NAS papers often use different training pipelines , different search spaces and different hyperparameters , do not evaluate other methods under comparable settings , and can not afford enough runs for testing significance . This practice impedes assertions about the statistical significance of the reported results , recently brought into focus by several authors ( Yang et al. , 2019 ; Lindauer & Hutter , 2019 ; Shu et al. , 2020 ; Yu et al. , 2020 ) . To circumvent these issues and enable scientifically sound evaluations in NAS , several tabular benchmarks ( Ying et al. , 2019 ; Zela et al. , 2020b ; Dong & Yang , 2020 ; Klyuchnikov et al. , 2020 ) have been proposed recently ( see also Appendix A.1 for more details ) . However , all these benchmarks rely on an exhaustive evaluation of all architectures in a search space , which limits them to unrealistically small search spaces ( so far containing only between 6k and 423k architectures ) . This is a far shot from standard spaces used in the NAS literature , which contain more than 1018 architectures ( Zoph & Le , 2017 ; Liu et al. , 2019b ) . This discrepancy can cause results gained on existing tabular NAS benchmarks to not generalize to realistic search spaces ; e.g. , promising anytime results of local search on existing tabular NAS benchmarks were shown to not transfer to realistic search spaces ( White et al. , 2020b ) . To address these problems , we make the following contributions : 1 . We present NAS-Bench-301 , a surrogate NAS benchmark that is first to cover a realistically-sized search space ( namely the cell-based search space of DARTS ( Liu et al. , 2019b ) ) , containing more than 1018 possible architectures . This is made possible by estimating their performance via a surrogate model , removing the constraint to exhaustively evaluate the entire search space . 2 . We empirically demonstrate that a surrogate fitted on a subset of architectures can in fact model the true performance of architectures better than a tabular benchmark ( Section 2 ) . 3 . We analyze and release the NAS-Bench-301 training dataset consisting of∼60k fully trained and evaluated architectures , which will also be publicly available in the Open Graph Benchmark ( Hu et al. , 2020 ) ( Section 3 ) . 4 . Using this dataset , we thoroughly evaluate a variety of regression models as surrogate candidates , showing that strong generalization performance is possible even in large spaces ( Section 4 ) . 5 . We utilize NAS-Bench-301 as a benchmark for running various NAS optimizers and show that the resulting search trajectories closely resemble the ground truth trajectories . This enables sound simulations of thousands of GPU hours in a few seconds on a single CPU machine ( Section 5 ) . 6 . We demonstrate that NAS-Bench-301 can help in generating new scientific insights by studying a previous hypothesis on the performance of local search in the DARTS search space ( Section 6 ) . To foster reproducibility , we open-source all our code and data in a public repo : https : // anonymous.4open.science/r/3f99ef91-c472-4394-b666-5d464e099aca/ 2 MOTIVATION – CAN WE DO BETTER THAN A TABULAR BENCHMARK ? . We start by motivating the use of surrogate benchmarks by exposing an issue of tabular benchmarks that has largely gone unnoticed . Tabular benchmarks are built around a costly , exhaustive evaluation of all possible architectures in a search space , and when an architecture ’ s performance is queried , the tabular benchmark simply returns the respective table entry . The issue with this process is that the stochasticity of mini-batch training is also reflected in the performance of an architecture i , hence making it a random variable Yi . Therefore , the table only contains results of a few draws yi ∼ Yi ( existing NAS benchmarks feature up to 3 runs per architecture ) . Given the variance in these evaluations , a tabular benchmark acts as a simple estimator that assumes independent random variables , and thus estimates the performance of an architecture based only on previous evaluations of the same architecture . From a machine learning perspective , knowing that similar architectures tend to yield similar performance , and that the variance of individual evaluations can be high ( both shown to be the case by Ying et al . ( 2019 ) ) , it is natural to assume that better estimators may exist . In the remainder of this section , we empirically verify this hypothesis and show that surrogate benchmarks can provide better performance estimates than tabular benchmarks based on less data . Setup We choose NAS-Bench-101 ( Ying et al. , 2019 ) as a tabular benchmark for our analysis and a Graph Isomorphism Network ( GIN , Xu et al . ( 2019a ) ) as our surrogate model.1 Each architecture xi in NAS-Bench-101 contains 3 validation accuracies y1i , y 2 i , y 3 i from training xi with 3 different seeds . We excluded all diverged models with less than 50 % validation accuracy on any of the three evaluations in NAS-Bench-101 . We split this dataset to train the GIN surrogate model on one of the seeds , e.g. , Dtrain = { ( xi , y1i ) } i and evaluate on the other two , e.g. , Dtest = { ( xi , ȳ23i ) } i , where ȳ23i = ( y2i + y3i ) /2 . We emphasize that training a surrogate to model a search space is not a typical inductive regression task but rather a transductive one . By definition of the search space , the set of possible architectures is known ahead of time ( although it may be very large ) , hence a surrogate model does not have to generalize to out-ofdistribution data if the training data covers the space well . Results We compute the mean absolute error MAE = ∑ i |ŷi−ȳ 23 i | n of the surrogate model trained on Dtrain = { ( xi , y1i ) } i , where ŷi is predicted validation accuracy and n = |Dtest| . Table 1 shows that the surrogate model yields a lower MAE than the tabular benchmark , i.e . MAE = ∑ i |y 1 i−ȳ 23 i | n . We also report the mean squared error and Kendall tau correlation coefficient in Table 6 in the Appendix showing that the ranking between architectures is also predicted better by the surrogate . 1We used a GIN implementation by Errica et al . ( 2020 ) ; see Appendix B for details on training the GIN . We repeat the experiment in a cross-validation fashion w.r.t to the seeds and conclude : In contrast to a single tabular entry , the surrogate model learns to smooth out the noise.2 Next , we fit the GIN surrogate on subsets of Dtrain and plot how its performance scales with the amount of training data used in Figure 1 . The surrogate model performs better than the tabular benchmark when the training set has more than ∼21,500 architectures . Note that Dtest remains the same as in the previous experiment , i.e. , it includes all architectures in NAS-Bench-101 . As a result , we conclude that : A surrogate model can yield strong predictive performance when only a subset of the search space is available as training data . These empirical findings suggest that we can create reliable surrogate benchmarks for much larger and more realistic NAS spaces , which are infeasible to be exhaustively evaluated as done by tabular benchmarks . In the remainder of the paper , we focus on creating such a benchmark . 3 THE NAS-BENCH-301 DATASET We now describe the NAS-Bench-301 dataset which consists of ∼60k architectures and their performances on CIFAR-10 ( Krizhevsky , 2009 ) sampled from the most popular NAS cell search space : the one from DARTS ( Liu et al. , 2019b ) . We use this dataset not only to fit surrogate models but also to gain new insights , such as which regions of the architecture space are being explored by different NAS methods , or what the characteristics of architectures are that work well . 3.1 DATA COLLECTION . Since the DARTS search space ( detailed description in Appendix C.1 ) is far too large to be exhaustively evalu- ated , care has to be taken when sampling the architectures which will be used to train the surrogate models . Sampling should yield a good overall coverage of the architecture space while also providing a special focus on the well-performing regions that optimizers tend to exploit . Our principal methodology is inspired by Eggensperger et al . ( 2015 ) , who collected unbiased data about hyperparameter spaces by random search , as well as biased and dense samples in high-performance regions by running hyperparameter optimizers . This is desirable for a surrogate benchmark since we are interested in evaluating NAS methods that exploit such good regions of the space . Table 2 lists the NAS methods we used to collect such samples and the respective number of samples . Additionally , we evaluated ∼1k architectures in poorly-performing regions for better coverage and another ∼10k for the analysis conducted on the dataset and surrogates . We refer to Appendices C.2 and C.3 for details on the data collection and the optimizers , respectively . We would like to point out that in hindsight adding training data of well-performing regions may be less important for a surrogate NAS benchmark than for a surrogate HPO benchmark , which we demonstrated in Appendix E.3 . We argue that this is a result of HPO 2We do note that the average estimation error of tabular benchmarks could be reduced by a factor of √ k by performing k runs for each architecture . The error of a surrogate model would also shrink when the model is based on more data , but as k grows large tabular benchmarks would become competitive with surrogate models . search spaces containing many configurations which yield disfunctional models , which is less common for architectures in many NAS search spaces , hence allowing random search to give us good coverage of the space . In Figure 2 , we visualize the overall coverage of the search space as well as the similarity between sampled architectures using t-SNE ( van der Maaten & Hinton , 2008 ) . Besides showing a good overall coverage , some well-performing architectures in the search space form distinct clusters which are mostly located outside the main cloud of points . This clearly indicates that architectures with similar performance are close to each other in the architecture space . Additionally , we observe that different optimizers sample different types of architectures , see Figure 9 in the Appendix . 3.2 PERFORMANCE STATISTICS . Figure 3 shows the validation error on CIFAR-10 ( Krizhevsky , 2009 ) of all sampled architectures in relation to the model parameters and training runtime . Generally , as expected , models with more parameters are more costly to train but achieve lower validation errors . We also find that different NAS methods yield quite different performance distributions ( see Appendix C.4 for their individual performances ) . Validation and test errors are highly correlated with a Kendall tau rank correlation of τ = 0.852 ( Spearman rank corr . 0.969 ) , minimizing the risk of overfitting on the validation error . Furthermore , we find that cells of all depths can reach a good performance , but shallow topologies are slightly favored in our setting ( see Figure 10 in the Appendix ) . Also , a small number of parameter-free operations ( e.g. , skip connections ) can benefit the performance but featuring many of these significantly deteriorates performance . For the full analysis , see Appendix C.5 . Following standard practice in modern NAS papers ( e.g. , Liu et al . ( 2019b ) ) , we employ various data augmentation techniques during training for more reliable estimates of an architecture ’ s performance . For a description of our full training pipeline , please see Appendix C.6 .
The authors propose a new benchmark for evaluating surrogate functions for architecture search. According to the authors, existing tabular architecture search benchmarks are insufficient for this purpose due to using overly small search spaces. The main difference of this benchmark and other existing architecture search benchmarks such as NAS Bench 101 and NAS Bench 201 is that they do not attempt to evaluate all the architectures in the search space and do so for a much larger search space (DARTS). The authors then use this new dataset to show that surrogate functions are better than tabular estimators (error wise; although some lower performance architectures were discarded to make this case). Additionally, the authors compare the proposed benchmark (based on surrogate functions) with a real benchmark and observe that the results are qualitatively similar. Finally, the authors show that reevaluate the claim that local search is state-of-the-art for architecture search and find that, using their benchmark, that local search is still state-of-the-art provided that enough computational budget is available for the experiment.
SP:59210764f21eadc8e69e720f9d12f3b85cf74ceb
Learning to Generate Questions by Recovering Answer-containing Sentences
1 INTRODUCTION . Machine reading comprehension ( MRC ) , which finds the answer to a given question from its accompanying paragraphs ( called context ) , is an essential task in natural language processing . With the release of high-quality human-annotated datasets for this task , such as SQuAD-v1.1 ( Rajpurkar et al. , 2016 ) , SQuAD-v2.0 ( Rajpurkar et al. , 2018 ) , and KorQuAD ( Lim et al. , 2019 ) , researchers have proposed MRC models even surpassing human performance . These datasets commonly involve finding a snippet within a context as an answer to a given question . However , these datasets require significant amount of human effort to create questions and their relevant answers from given contexts . Often the size of the annotated data is relatively small compared to that of data used in other self-supervised tasks such as language modeling , limiting the accuracy . To overcome this issue , researchers have studied models for generating synthetic questions from a given context along with annotated ( or generated ) answers on large corpora such as Wikipedia . Golub et al . ( 2017 ) suggest a two-stage network of generating question-answer pairs which first chooses answers conditioned on the paragraph and then generates a question conditioned on the chosen answer . Dong et al . ( 2019 ) showed that pre-training on unified language modeling from large corpora including Wikipedia improves the question generation capability . Similarly , Alberti et al . ( 2019 ) introduced a self-supervised pre-training technique for question generation via the nextsentence generation task . However , self-supervised pre-training techniques such as language modeling or next sentence generation are not specifically conditioned on the candidate answer and instead treat it like any other phrase , despite the candidate answer being a strong conditional restriction for the question generation task . Also , not all sentences from a paragraph may be relevant to the questions or answers , so task of their generation may not be an ideal candidate as a pre-training method for question generation tasks . Moreover , in question generation it is important to determine which part of a given context can be a suitable answer for generating questions . To address these issues , we propose a novel training method called Answer-containing Sentence Generation ( ASGen ) for a question generator . ASGen is composed of two steps : ( 1 ) dynamically predicting K answers to generate diverse questions and ( 2 ) pre-training the question generator on the answer-containing sentence generation task . We evaluate our method against existing ones in terms of the generated question quality as well as the fine-tuned MRC model accuracy after training on the data synthetically generated by our method . Experimental results demonstrate that our approach consistently improves the question generation quality of existing models such as T5 ( Raffel et al. , 2020 ) and UniLM ( Dong et al. , 2019 ) , and shows state-of-the-art results on MS MARCO ( Nguyen et al. , 2016 ) , NewsQA ( Trischler et al. , 2017 ) , as well as comparable results to the state-of-the-art on SQuAD . Additionally , we demonstrate that the synthetically generated data by our approach can boost up downstream MRC accuracy across a wide range of datasets , such as SQuAD-v1.1 , v2.0 , and KorQuAD , without any modification to the existing MRC models . Furthermore , our experiments highlight that our method shines especially when a limited amount of training data is given , in terms of both pre-training and downstream MRC data . 2 PROPOSED METHOD . This section discusses our proposed training method called Answer-containing Sentence Generation ( ASGen ) . While ASGen can be applied to any generative model , we use a simple Transformer ( Vaswani et al. , 2017 ) based generative model as our baseline , which we call BertGen . First , we will describe how the BertGen model generates synthetic questions and answers from a context . Next , we will explain the novel components of our methods and how we pre-trained the question generator in BertGen based on them . BertGen encodes given paragraphs with two networks , the answer generator and the question generator . Answer Generator . To make the contextual embeddings and to predict answer spans for a given context without the question , we utilize a BERT ( Devlin et al. , 2019 ) encoder ( Fig . 1- ( 1 ) , BERT Encoder-A ) . We estimate the number of answer candidates K by applying a fully connected layer on the contextual embedding of BERT ’ s classification token “ [ CLS ] ” . Depending on the estimated number K , we select the K top candidate answer spans from the context . We use the K selected answer spans as input to the question generator . Question Generator . Next , we generate a question conditioned on each answer predicted from the answer generator . Specifically , we give as input to a BERT encoder the context and an indicator for the answer span location in the context ( Fig . 1- ( 2 ) , BERT Encoder-Q ) . Next , a Transformer decoder generates the question word-by-word based on the encoded representation of the context and the answer span . When pre-training the question generator on an answer-containing sentence generation task , we exclude the answer-containing sentence from the original context and train the model to generate the excluded sentence given the modified context and the answer span as input . Finally , we generate synthetic questions and answers from a large corpus , e.g. , all the paragraphs in Wikipedia . After generating this data , we train the MRC model on the generated data in the first phase and then fine-tune on the downstream MRC dataset ( e.g. , SQuAD ) in the second phase . In this paper , we use BERT as the default MRC model , since BERT or its variants achieve state-of-the-art performance across numerous MRC tasks . 2.1 DYNAMIC ANSWER PREDICTION . In question generation , it is important to determine which part of a given context can be a suitable answer for generating questions . To this end , we predict the number of answer K in a given context W = { wt } Tt=0 to obtain a more appropriate set of “ answer-like ” phrases , i.e. , { wenct } Tt=0 = BERT Encoder-A ( W ) , K = bfk ( wenc0 ) c , where T is the number of word tokens in the context , and position 0 reserved for classification token ‘ [ CLS ] ’ . fk represents a fully connected unit with two hidden layers that have hidden dimensions equal to H and 1 , respectively , where H is the hidden dimension of BERT Encoder-A . For training , we use the mean squared error loss between the output value of fk and ground-truth number of answers Kgt . To calculate the score si for start index i of a predicted answer span , we compute the dot product of the encoder output with a trainable vector vs. For each start index i , we calculate the span end index score ei , j for index j in a similar manner with a trainable vector ve , i.e. , si = vs ◦wenci , ei , j = ve ◦ fs ( wencj ⊕wenci ) , where fs represents a fully connected layer with hidden dimension H and ⊕ indicates the concatenation operation . For training , we use cross-entropy loss on the si , ei , j and ground truth start , end of the answer span for each token . Predicting the number of answers and the answer span are jointly trained to minimize the sum of their respective losses . During inference , we choose the K top answer spans with the highest score summation of start index score and end index score , i.e. , Aspan = { ( i , j ) | 1 ≤ i < T and i ≤ j < T } , ak = max ( { a | # { ( i , j ) | ( i , j ) ∈ Aspan and si + ei , j ≥ a } = K } ) , Aspank = { ( i , j ) | ( i , j ) ∈ A span and si + ei , j ≥ ak } . The K selected answer spans Aspank are then given to the question generator as input in the form of an indication of the answer span location in the given context . 2.2 PRE-TRAINING QUESTION GENERATOR . In order to generate questions conditioned on different answers that may arise in a context , we generate a question for each of the K answers . Alberti et al . ( 2019 ) proposed a pre-training method for this generative model using the self-supervised task of generating the next-sentence . We identify several issues with this approach . This technique is not specifically conditioned on the answer , despite the answer being a strong condition for the question generation task . Also , not all sentences from a paragraph may be relevant to the questions or answers from within that paragraph , so their generation is not an ideal candidate for pre-training question generation model . To address these issues , we modify the context to exclude the sentence containing the previously generated answer and pre-train the question generation model on the task of generating this excluded answer-containing sentence , conditioned on the answer and the modified context . Specifically , we exclude answer-containing sentence Sans while retaining the answer , modifying the original context D to Dans as Sstart = { p | sentence start index = p } ∪ { T } , Sans = { ( ps , pe , i , j ) | max ( { p≤i } ) s , min ( { p≥j } ) e } , Dans = [ D [ : ps ] ; D [ i : j ] ; D [ pe : ] ] , ( ps , pe , i , j ) ∈ S ans , where ( i , j ) ∈ Aspank . Note that we change Sans to not exclude the answer-containing sentence for fine-tuning the question generator , i.e. , Sans = { ( ps , pe , i , j ) |ps = i , pe = j } . In BertGen , we pass the previously generated answer to the generation model in the form of an additional position encoding Mans that indicates the answer location within the context , i.e. , Mans = [ m0 ∗ ps ; m1 ∗ ( j − i ) ; m0 ∗ ( T − pe ) ] , where m0 and m1 indicate trainable vectors corresponding to encoding id 0 and 1 , respectively . That is , we assign the encoding id for each word in the context as 0 and each word in the answer as 1 . A ∗B indicates the operation of stacking vector A for B many times . Next , we generate answer-containing sentence output words probability W o = { wot } T0 as Cenc = BERT Encoder-Q ( Dans , Mans ) , wgt = Transformer Decoder ( { w g i } t−1 i=0 , C enc ) , { wot } Tt=0 = { Softmax ( w g tE ) } Tt=0 , where Cenc is encoded representation of the context and E ∈ Rd×D represents a word embedding matrix with vocabulary size D shared between the BERT Encoder-Q and the Transformer decoder . Finally , we calculate the loss of the generated words using the cross-entropy loss as L = − ( T∑ t=1 D∑ i=1 yt , ilog ( wot , i ) ) /T , where y indicates a ground-truth one-hot vector of the answer-containing sentence word . Note that y is the question word in the case of fine-tuning . In this manner , we pre-train the question generation model using a task similar to the final task of conditionally generating the question from a given answer and a context .
This paper proposes a pretraining technique for question-generation models. The pretraining involves generating the sentence which contains an answer candidate from the context around it. Through several well-executed experiments the paper shows that this type of pretraining can improve performance of several existing question generation models, and the resulting synthetic questions generated help in augmenting reading comprehension datasets.
SP:b7af23a88486ea212c5c3061202b5cc7c179bc68
Learning to Generate Questions by Recovering Answer-containing Sentences
1 INTRODUCTION . Machine reading comprehension ( MRC ) , which finds the answer to a given question from its accompanying paragraphs ( called context ) , is an essential task in natural language processing . With the release of high-quality human-annotated datasets for this task , such as SQuAD-v1.1 ( Rajpurkar et al. , 2016 ) , SQuAD-v2.0 ( Rajpurkar et al. , 2018 ) , and KorQuAD ( Lim et al. , 2019 ) , researchers have proposed MRC models even surpassing human performance . These datasets commonly involve finding a snippet within a context as an answer to a given question . However , these datasets require significant amount of human effort to create questions and their relevant answers from given contexts . Often the size of the annotated data is relatively small compared to that of data used in other self-supervised tasks such as language modeling , limiting the accuracy . To overcome this issue , researchers have studied models for generating synthetic questions from a given context along with annotated ( or generated ) answers on large corpora such as Wikipedia . Golub et al . ( 2017 ) suggest a two-stage network of generating question-answer pairs which first chooses answers conditioned on the paragraph and then generates a question conditioned on the chosen answer . Dong et al . ( 2019 ) showed that pre-training on unified language modeling from large corpora including Wikipedia improves the question generation capability . Similarly , Alberti et al . ( 2019 ) introduced a self-supervised pre-training technique for question generation via the nextsentence generation task . However , self-supervised pre-training techniques such as language modeling or next sentence generation are not specifically conditioned on the candidate answer and instead treat it like any other phrase , despite the candidate answer being a strong conditional restriction for the question generation task . Also , not all sentences from a paragraph may be relevant to the questions or answers , so task of their generation may not be an ideal candidate as a pre-training method for question generation tasks . Moreover , in question generation it is important to determine which part of a given context can be a suitable answer for generating questions . To address these issues , we propose a novel training method called Answer-containing Sentence Generation ( ASGen ) for a question generator . ASGen is composed of two steps : ( 1 ) dynamically predicting K answers to generate diverse questions and ( 2 ) pre-training the question generator on the answer-containing sentence generation task . We evaluate our method against existing ones in terms of the generated question quality as well as the fine-tuned MRC model accuracy after training on the data synthetically generated by our method . Experimental results demonstrate that our approach consistently improves the question generation quality of existing models such as T5 ( Raffel et al. , 2020 ) and UniLM ( Dong et al. , 2019 ) , and shows state-of-the-art results on MS MARCO ( Nguyen et al. , 2016 ) , NewsQA ( Trischler et al. , 2017 ) , as well as comparable results to the state-of-the-art on SQuAD . Additionally , we demonstrate that the synthetically generated data by our approach can boost up downstream MRC accuracy across a wide range of datasets , such as SQuAD-v1.1 , v2.0 , and KorQuAD , without any modification to the existing MRC models . Furthermore , our experiments highlight that our method shines especially when a limited amount of training data is given , in terms of both pre-training and downstream MRC data . 2 PROPOSED METHOD . This section discusses our proposed training method called Answer-containing Sentence Generation ( ASGen ) . While ASGen can be applied to any generative model , we use a simple Transformer ( Vaswani et al. , 2017 ) based generative model as our baseline , which we call BertGen . First , we will describe how the BertGen model generates synthetic questions and answers from a context . Next , we will explain the novel components of our methods and how we pre-trained the question generator in BertGen based on them . BertGen encodes given paragraphs with two networks , the answer generator and the question generator . Answer Generator . To make the contextual embeddings and to predict answer spans for a given context without the question , we utilize a BERT ( Devlin et al. , 2019 ) encoder ( Fig . 1- ( 1 ) , BERT Encoder-A ) . We estimate the number of answer candidates K by applying a fully connected layer on the contextual embedding of BERT ’ s classification token “ [ CLS ] ” . Depending on the estimated number K , we select the K top candidate answer spans from the context . We use the K selected answer spans as input to the question generator . Question Generator . Next , we generate a question conditioned on each answer predicted from the answer generator . Specifically , we give as input to a BERT encoder the context and an indicator for the answer span location in the context ( Fig . 1- ( 2 ) , BERT Encoder-Q ) . Next , a Transformer decoder generates the question word-by-word based on the encoded representation of the context and the answer span . When pre-training the question generator on an answer-containing sentence generation task , we exclude the answer-containing sentence from the original context and train the model to generate the excluded sentence given the modified context and the answer span as input . Finally , we generate synthetic questions and answers from a large corpus , e.g. , all the paragraphs in Wikipedia . After generating this data , we train the MRC model on the generated data in the first phase and then fine-tune on the downstream MRC dataset ( e.g. , SQuAD ) in the second phase . In this paper , we use BERT as the default MRC model , since BERT or its variants achieve state-of-the-art performance across numerous MRC tasks . 2.1 DYNAMIC ANSWER PREDICTION . In question generation , it is important to determine which part of a given context can be a suitable answer for generating questions . To this end , we predict the number of answer K in a given context W = { wt } Tt=0 to obtain a more appropriate set of “ answer-like ” phrases , i.e. , { wenct } Tt=0 = BERT Encoder-A ( W ) , K = bfk ( wenc0 ) c , where T is the number of word tokens in the context , and position 0 reserved for classification token ‘ [ CLS ] ’ . fk represents a fully connected unit with two hidden layers that have hidden dimensions equal to H and 1 , respectively , where H is the hidden dimension of BERT Encoder-A . For training , we use the mean squared error loss between the output value of fk and ground-truth number of answers Kgt . To calculate the score si for start index i of a predicted answer span , we compute the dot product of the encoder output with a trainable vector vs. For each start index i , we calculate the span end index score ei , j for index j in a similar manner with a trainable vector ve , i.e. , si = vs ◦wenci , ei , j = ve ◦ fs ( wencj ⊕wenci ) , where fs represents a fully connected layer with hidden dimension H and ⊕ indicates the concatenation operation . For training , we use cross-entropy loss on the si , ei , j and ground truth start , end of the answer span for each token . Predicting the number of answers and the answer span are jointly trained to minimize the sum of their respective losses . During inference , we choose the K top answer spans with the highest score summation of start index score and end index score , i.e. , Aspan = { ( i , j ) | 1 ≤ i < T and i ≤ j < T } , ak = max ( { a | # { ( i , j ) | ( i , j ) ∈ Aspan and si + ei , j ≥ a } = K } ) , Aspank = { ( i , j ) | ( i , j ) ∈ A span and si + ei , j ≥ ak } . The K selected answer spans Aspank are then given to the question generator as input in the form of an indication of the answer span location in the given context . 2.2 PRE-TRAINING QUESTION GENERATOR . In order to generate questions conditioned on different answers that may arise in a context , we generate a question for each of the K answers . Alberti et al . ( 2019 ) proposed a pre-training method for this generative model using the self-supervised task of generating the next-sentence . We identify several issues with this approach . This technique is not specifically conditioned on the answer , despite the answer being a strong condition for the question generation task . Also , not all sentences from a paragraph may be relevant to the questions or answers from within that paragraph , so their generation is not an ideal candidate for pre-training question generation model . To address these issues , we modify the context to exclude the sentence containing the previously generated answer and pre-train the question generation model on the task of generating this excluded answer-containing sentence , conditioned on the answer and the modified context . Specifically , we exclude answer-containing sentence Sans while retaining the answer , modifying the original context D to Dans as Sstart = { p | sentence start index = p } ∪ { T } , Sans = { ( ps , pe , i , j ) | max ( { p≤i } ) s , min ( { p≥j } ) e } , Dans = [ D [ : ps ] ; D [ i : j ] ; D [ pe : ] ] , ( ps , pe , i , j ) ∈ S ans , where ( i , j ) ∈ Aspank . Note that we change Sans to not exclude the answer-containing sentence for fine-tuning the question generator , i.e. , Sans = { ( ps , pe , i , j ) |ps = i , pe = j } . In BertGen , we pass the previously generated answer to the generation model in the form of an additional position encoding Mans that indicates the answer location within the context , i.e. , Mans = [ m0 ∗ ps ; m1 ∗ ( j − i ) ; m0 ∗ ( T − pe ) ] , where m0 and m1 indicate trainable vectors corresponding to encoding id 0 and 1 , respectively . That is , we assign the encoding id for each word in the context as 0 and each word in the answer as 1 . A ∗B indicates the operation of stacking vector A for B many times . Next , we generate answer-containing sentence output words probability W o = { wot } T0 as Cenc = BERT Encoder-Q ( Dans , Mans ) , wgt = Transformer Decoder ( { w g i } t−1 i=0 , C enc ) , { wot } Tt=0 = { Softmax ( w g tE ) } Tt=0 , where Cenc is encoded representation of the context and E ∈ Rd×D represents a word embedding matrix with vocabulary size D shared between the BERT Encoder-Q and the Transformer decoder . Finally , we calculate the loss of the generated words using the cross-entropy loss as L = − ( T∑ t=1 D∑ i=1 yt , ilog ( wot , i ) ) /T , where y indicates a ground-truth one-hot vector of the answer-containing sentence word . Note that y is the question word in the case of fine-tuning . In this manner , we pre-train the question generation model using a task similar to the final task of conditionally generating the question from a given answer and a context .
This paper presents a model for unsupervised pre-training for the task of question generation. The model first predicts the number of answer present in a given paragraph and then selects the top-K answer spans from the paragraph. After selecting the answer spans, the model, then tries to generate the answer containing sentence by inputting the paragraphs less the answer-containing sentence and also the answer span. The key idea is that this unsupervised pre-training strategy is close to the actual task of generating question given the context and the answer. This is also the key differentiator between this work and other existing pre-training strategies for question generation (e.g. Alberti et al 2019).
SP:b7af23a88486ea212c5c3061202b5cc7c179bc68
Neurosymbolic Deep Generative Models for Sequence Data with Relational Constraints
1 INTRODUCTION . There has been tremendous recent progress in designing deep generative models for generating sequence data such as natural language ( Vaswani et al. , 2017 ) or music ( Huang et al. , 2019 ) . These approaches leverage the vast quantities of data available in conjunction with unsupervised and selfsupervised learning to learn probabilistic models of the data ; then , new examples can be generated by sampling from these models , with the possibility of conditioning on initial elements of the sequence . A key challenge facing deep generative models is the difficulty incorporating high-level structure into the generated examples—e.g. , rhyming and meter across lines of a poem , or repetition across measures of a piece of music . Capturing high-level structure is important for improving the quality of the generated data , especially in low-data regimes where only small numbers of examples are available ; intuitively , knowledge of the structure compresses the amount of information the generative model has to learn . Furthermore , explicit representations of structure ( i.e. , symbolically rather than as a vector embedding ) has the benefit that users can modify the structure to guide generation . Recently , Young et al . ( 2019 ) proposed neurosymbolic generative models for incorporating high-level structure into image generation , focusing on simple 2D repeating patterns in images of building facades ( e.g. , repeating windows ) . The basic idea is to leverage program synthesis to extract structure from data—in particular , given an example image x , they devise an algorithm A that extracts a program c = A ( x ) that represents the set of 2D repeating patterns present in training examples x . Then , using the pairs ( x , c ) , they train two generative models : ( i ) a model pφ ( c ) that generates a program , and ( ii ) a model pθ ( x | c ) that generates an image that contains the structure represented by c. However , their approach is heavily tailored to images in two ways . First , their representation of structure is geared towards simple patterns occurring in images of building facades . Second , their algorithm A is specifically designed to extract this kind of program from an image , as are their models pφ ( c ) for generating programs c and pθ ( x | c ) for generating images x conditioned on c. We represent the relational constraints cx present in an example x by relating each subcomponent w of a given example x with a prototype w̃ , which can be thought of as the “ original '' subcomponent from which w is constructed . In particular , the relationship between w and w̃ is labeled with a set of relations R , which encodes the constraint that w and w̃ should satisfy relation r for each r ∈ R. Importantly , while each subcomponent is associated with a single prototype , each prototype may be associated with multiple subcomponents . As a consequence , different subcomponents associated with the same prototype are related in some way . This representation is compact , only requiring linearly many constraints in the number of subcomponents in x ( assuming the number of prototypes is constant ) . Compactness ensures the representation both generalizes well and is easy to generate . Then , we design a synthesis algorithm that can extract an optimal representation of the structure present in a training example x ( i.e. , the relational constraints cx ) . We show how to express the synthesis problem as a constrained combinatorial optimization problem , which we solve using an SMT solver Z3 ( De Moura & Bjørner , 2008 ) . Next , we represent relational constraints c as sequences , and design the model pφ ( c ) to be a specialized sequence VAE . Finally , we propose three possible designs of pθ ( x | c ) , all of which try to identify an example x that is realistic ( e.g. , according to a pretrained model pθ ( x ) ) while simultaneously satisfies the given constraints c. We evaluate our approach on two tasks : poetry generation , where the relational constraints include rhyming lines or lines with shared meter , and music generation , where the relational constraints include equality in terms of pitch or rhythm , that one measure is a transposition of another ( i.e. , pitches shifted up or down by a constant amount ) , etc . We show that our approaches outperform or perform similarly to state-of-the-art models in terms of low-level structure , while significantly outperforming them in terms of high-level structure . We also perform a user study in the poetry domain to determine user-perceived quality of the generated poetry along three dimensions ( structure , lyricism , and coherence ) , and found that on average , our approach outperformed state-of-the-art baselines including GPT-2 . Finally , we demonstrate how our approach allows users to guide the generation process without sacrificing overall realism by specifying values of constraints . Example . Figure 1 illustrates how our approach is applied to generate poetry . During training , our approach uses program synthesis to infer relational constraints cx present in the examples x , and uses both x and cx to train the generative models . Here , cx is a bipartite graph , where the LHS vertices are prototypes , and the RHS vertices correspond to lines of x . Each vertex on the right is connected to exactly one prototype , and is labeled with constraints on how it should relate to its prototype . To generate new examples , it first samples relational constraints c , and then samples an example x that satisfies c—i.e. , we need to choose a line to fill each RHS node in a way that the line satisfies the relations with its prototype . Furthermore , a user can modify the sampled constraint c to guide the generative process . Thus , our approach enables users to flexibly incorporate domain knowledge on the high-level structure of the data into the generative process , both in terms of the relational constraints included and by allowing them to modify the generated relational constraints . Related work . There has been recent work using program synthesis to improve machine learning . For instance , it has been applied to unsupervised learning of latent structure in drawings ( Ellis et al. , 2015 ) and to reinforcement learning ( Verma et al. , 2018 ) . These techniques have benefits such as improving interpretability ( Verma et al. , 2018 ; Ellis et al. , 2020 ) , enabling learning from fewer examples ( Ellis et al. , 2015 ) , generalizing more robustly ( Inala et al. , 2019 ) , and being easier to formally verify ( Bastani et al. , 2018 ) . More recently , there has been work leveraging program synthesis in conjunction with deep learning , where the DNN handles perception and program synthesis handles high-level structure ( Ellis et al. , 2017 ) , including work in the lifelong learning setting ( Valkov et al. , 2018 ) . In contrast to these approaches , our focus is on generative models . In particular , we extend recent work leveraging these ideas for image generation to incorporating high-level relational structure into sequence generation tasks ( Young et al. , 2019 ) . Finally , much research over the past few decades has focused on music and poetry generation , and on using relational constraints in neural models ; we include a discussion of the most relevant such research in Appendix A . 2 BACKGROUND ON NEUROSYMBOLIC GENERATIVE MODELS . Consider the problem of learning a generative model given training data from the underlying distribution . Given training examples x1 , ... , xk ∼ p∗ , our goal is to learn a generative model pθ ≈ p∗ from which we can draw additional samples x ∼ pθ . We consider sequence data—i.e. , an example x ∈ X is a sequence x = ( w1 , ... , wm ) ∈ Wm.1 For example , each subcomponent w may be a line of a poem or a measure of music , and x may be a poem or song . 1We use a fixed m to simplify our exposition ; our approach trivially extends to variable m. We are interested in domains where likely examples satisfy latent relational constraints c ∈ C over the subcomponents . For instance , c may say that two measures wi and wj of x start with the same series of pitches , or that two lines wi and wj of x rhyme . We assume given a set of relationsR ( e.g. , r ∈ R might be “ rhyme ” or “ equal ” ) , and a function f : W ×W ×R → [ 0 , 1 ] such that f ( w , w′ , r ) indicates to what extent w and w′ satisfy relation r. Then , c is a compact representation of the relations present in an input x . We describe the structure of c in detail in Section 3.1 ; for now , the approach we describe works for any choice of c. In particular , we build on neurosymbolic generative models ( Young et al. , 2019 ) , where c is itself generated based on a latent value z ∈ Z—i.e. , pθ , φ ( x ) = ∫ ∑ c∈C pθ ( x | c ) · pφ ( c | z ) · p ( z ) dz . Then , Young et al . ( 2019 ) considers the variational distribution qφ̃ ( c , z | x ) = qφ̃ ( z | c ) · q ( c | x ) and q ( c | x ) = δ ( c− cx ) . Here , δ is the Dirac delta function and cx is a single representative generated from x using a program synthesis algorithm ( David & Kroening , 2017 ) —i.e. , an algorithm A that takes as input an example x and outputs a program c = A ( x ) encoding the relational constraints present in x . Next , Young et al . ( 2019 ) derive an evidence lower bound log pθ , φ ( x ) ≥ log pθ ( x | cx ) + Eqφ̃ ( z|cx ) [ log pφ ( cx | z ) ] −DKL ( qφ̃ ( z | cx ) ‖ p ( z ) ) . where DKL is the KL divergence and H is information entropy . The first term is the log-likelihood of a generative model predicting the probability of example x given relational constraints cx , and the second and third terms form the loss of a variational autoencoder ( VAE ) pφ ( c | z ) and qφ̃ ( z | c ) ( Kingma & Welling , 2019 ) . In summary , given training examples x ∈ X , this approach separately learns ( i ) a VAE to generate c , trained on the relational constraints cx synthesized from each training example x , and ( ii ) a model to generate x given cx ; the latter can take multiple forms such as a second VAE or a generative adversarial network ( GAN ) ( Goodfellow et al. , 2014 ) . This approach is called synthesis-guided generative models ( SGM ) since it uses program synthesis to guide training . To leverage this framework , we have to instantiate ( i ) the space of relational constraints C , ( ii ) the synthesis algorithm A : X → C used to extract a program encoding the structure of x , and ( iii ) the architectures of pφ ( c | z ) , qφ̃ ( z | c ) , and pθ ( x | c ) . In prior work , Young et al . ( 2019 ) used heuristics specific to the the image domain to achieve these goals—in particular , they used ( i ) simple equality constraints on sub-regions of the image designed to capture 2D repeating patterns , ( ii ) a custom synthesis algorithm that greedily adds constraints in the data to the program , and ( iii ) a representation of cx as an image , in which case pθ is a generative model over images , and pφ , qφ̃ based on an encoding of c as a fixed-length vector . We design a synthesis algorithm that expresses the synthesis problem as a constrained combinatorial optimization problem , which it solves using an SMT solver called Z3 ( De Moura & Bjørner , 2008 ) . In terms of ( iii ) , our programs encode declarative constraints rather than imperative renderings , so the previous architectures of pφ , and qφ̃ can not be used . Instead , we use expert domain-specific heuristics , transformers ( Vaswani et al. , 2017 ) , or graph neural networks ( GNNs ) ( Kipf & Welling , 2017 ) for pφ and qφ̃ . For pθ , we propose several methods for imposing the constraints encoded by c when generating an example x .
This paper proposes an approach for generating sequences that possess high-level structure, and in particular structure that can be expressed using hand-crafted symbolic relations. Given a domain and a set of possible relations to consider, this approach first extracts a sequence representation of the relational constraints for each example, then trains a two-stage generative model that first generates relational constraints and then generates the final output conditioned on the constraints. The authors apply their approach to the generation of music and poetry, and show that, compared to simple baselines, the generated outputs are more consistent with human-generated examples (according to other learned models of high- and low-level structure).
SP:ca0c4bdb02f7d939fb6de38b6b446ced4b5984a0
Neurosymbolic Deep Generative Models for Sequence Data with Relational Constraints
1 INTRODUCTION . There has been tremendous recent progress in designing deep generative models for generating sequence data such as natural language ( Vaswani et al. , 2017 ) or music ( Huang et al. , 2019 ) . These approaches leverage the vast quantities of data available in conjunction with unsupervised and selfsupervised learning to learn probabilistic models of the data ; then , new examples can be generated by sampling from these models , with the possibility of conditioning on initial elements of the sequence . A key challenge facing deep generative models is the difficulty incorporating high-level structure into the generated examples—e.g. , rhyming and meter across lines of a poem , or repetition across measures of a piece of music . Capturing high-level structure is important for improving the quality of the generated data , especially in low-data regimes where only small numbers of examples are available ; intuitively , knowledge of the structure compresses the amount of information the generative model has to learn . Furthermore , explicit representations of structure ( i.e. , symbolically rather than as a vector embedding ) has the benefit that users can modify the structure to guide generation . Recently , Young et al . ( 2019 ) proposed neurosymbolic generative models for incorporating high-level structure into image generation , focusing on simple 2D repeating patterns in images of building facades ( e.g. , repeating windows ) . The basic idea is to leverage program synthesis to extract structure from data—in particular , given an example image x , they devise an algorithm A that extracts a program c = A ( x ) that represents the set of 2D repeating patterns present in training examples x . Then , using the pairs ( x , c ) , they train two generative models : ( i ) a model pφ ( c ) that generates a program , and ( ii ) a model pθ ( x | c ) that generates an image that contains the structure represented by c. However , their approach is heavily tailored to images in two ways . First , their representation of structure is geared towards simple patterns occurring in images of building facades . Second , their algorithm A is specifically designed to extract this kind of program from an image , as are their models pφ ( c ) for generating programs c and pθ ( x | c ) for generating images x conditioned on c. We represent the relational constraints cx present in an example x by relating each subcomponent w of a given example x with a prototype w̃ , which can be thought of as the “ original '' subcomponent from which w is constructed . In particular , the relationship between w and w̃ is labeled with a set of relations R , which encodes the constraint that w and w̃ should satisfy relation r for each r ∈ R. Importantly , while each subcomponent is associated with a single prototype , each prototype may be associated with multiple subcomponents . As a consequence , different subcomponents associated with the same prototype are related in some way . This representation is compact , only requiring linearly many constraints in the number of subcomponents in x ( assuming the number of prototypes is constant ) . Compactness ensures the representation both generalizes well and is easy to generate . Then , we design a synthesis algorithm that can extract an optimal representation of the structure present in a training example x ( i.e. , the relational constraints cx ) . We show how to express the synthesis problem as a constrained combinatorial optimization problem , which we solve using an SMT solver Z3 ( De Moura & Bjørner , 2008 ) . Next , we represent relational constraints c as sequences , and design the model pφ ( c ) to be a specialized sequence VAE . Finally , we propose three possible designs of pθ ( x | c ) , all of which try to identify an example x that is realistic ( e.g. , according to a pretrained model pθ ( x ) ) while simultaneously satisfies the given constraints c. We evaluate our approach on two tasks : poetry generation , where the relational constraints include rhyming lines or lines with shared meter , and music generation , where the relational constraints include equality in terms of pitch or rhythm , that one measure is a transposition of another ( i.e. , pitches shifted up or down by a constant amount ) , etc . We show that our approaches outperform or perform similarly to state-of-the-art models in terms of low-level structure , while significantly outperforming them in terms of high-level structure . We also perform a user study in the poetry domain to determine user-perceived quality of the generated poetry along three dimensions ( structure , lyricism , and coherence ) , and found that on average , our approach outperformed state-of-the-art baselines including GPT-2 . Finally , we demonstrate how our approach allows users to guide the generation process without sacrificing overall realism by specifying values of constraints . Example . Figure 1 illustrates how our approach is applied to generate poetry . During training , our approach uses program synthesis to infer relational constraints cx present in the examples x , and uses both x and cx to train the generative models . Here , cx is a bipartite graph , where the LHS vertices are prototypes , and the RHS vertices correspond to lines of x . Each vertex on the right is connected to exactly one prototype , and is labeled with constraints on how it should relate to its prototype . To generate new examples , it first samples relational constraints c , and then samples an example x that satisfies c—i.e. , we need to choose a line to fill each RHS node in a way that the line satisfies the relations with its prototype . Furthermore , a user can modify the sampled constraint c to guide the generative process . Thus , our approach enables users to flexibly incorporate domain knowledge on the high-level structure of the data into the generative process , both in terms of the relational constraints included and by allowing them to modify the generated relational constraints . Related work . There has been recent work using program synthesis to improve machine learning . For instance , it has been applied to unsupervised learning of latent structure in drawings ( Ellis et al. , 2015 ) and to reinforcement learning ( Verma et al. , 2018 ) . These techniques have benefits such as improving interpretability ( Verma et al. , 2018 ; Ellis et al. , 2020 ) , enabling learning from fewer examples ( Ellis et al. , 2015 ) , generalizing more robustly ( Inala et al. , 2019 ) , and being easier to formally verify ( Bastani et al. , 2018 ) . More recently , there has been work leveraging program synthesis in conjunction with deep learning , where the DNN handles perception and program synthesis handles high-level structure ( Ellis et al. , 2017 ) , including work in the lifelong learning setting ( Valkov et al. , 2018 ) . In contrast to these approaches , our focus is on generative models . In particular , we extend recent work leveraging these ideas for image generation to incorporating high-level relational structure into sequence generation tasks ( Young et al. , 2019 ) . Finally , much research over the past few decades has focused on music and poetry generation , and on using relational constraints in neural models ; we include a discussion of the most relevant such research in Appendix A . 2 BACKGROUND ON NEUROSYMBOLIC GENERATIVE MODELS . Consider the problem of learning a generative model given training data from the underlying distribution . Given training examples x1 , ... , xk ∼ p∗ , our goal is to learn a generative model pθ ≈ p∗ from which we can draw additional samples x ∼ pθ . We consider sequence data—i.e. , an example x ∈ X is a sequence x = ( w1 , ... , wm ) ∈ Wm.1 For example , each subcomponent w may be a line of a poem or a measure of music , and x may be a poem or song . 1We use a fixed m to simplify our exposition ; our approach trivially extends to variable m. We are interested in domains where likely examples satisfy latent relational constraints c ∈ C over the subcomponents . For instance , c may say that two measures wi and wj of x start with the same series of pitches , or that two lines wi and wj of x rhyme . We assume given a set of relationsR ( e.g. , r ∈ R might be “ rhyme ” or “ equal ” ) , and a function f : W ×W ×R → [ 0 , 1 ] such that f ( w , w′ , r ) indicates to what extent w and w′ satisfy relation r. Then , c is a compact representation of the relations present in an input x . We describe the structure of c in detail in Section 3.1 ; for now , the approach we describe works for any choice of c. In particular , we build on neurosymbolic generative models ( Young et al. , 2019 ) , where c is itself generated based on a latent value z ∈ Z—i.e. , pθ , φ ( x ) = ∫ ∑ c∈C pθ ( x | c ) · pφ ( c | z ) · p ( z ) dz . Then , Young et al . ( 2019 ) considers the variational distribution qφ̃ ( c , z | x ) = qφ̃ ( z | c ) · q ( c | x ) and q ( c | x ) = δ ( c− cx ) . Here , δ is the Dirac delta function and cx is a single representative generated from x using a program synthesis algorithm ( David & Kroening , 2017 ) —i.e. , an algorithm A that takes as input an example x and outputs a program c = A ( x ) encoding the relational constraints present in x . Next , Young et al . ( 2019 ) derive an evidence lower bound log pθ , φ ( x ) ≥ log pθ ( x | cx ) + Eqφ̃ ( z|cx ) [ log pφ ( cx | z ) ] −DKL ( qφ̃ ( z | cx ) ‖ p ( z ) ) . where DKL is the KL divergence and H is information entropy . The first term is the log-likelihood of a generative model predicting the probability of example x given relational constraints cx , and the second and third terms form the loss of a variational autoencoder ( VAE ) pφ ( c | z ) and qφ̃ ( z | c ) ( Kingma & Welling , 2019 ) . In summary , given training examples x ∈ X , this approach separately learns ( i ) a VAE to generate c , trained on the relational constraints cx synthesized from each training example x , and ( ii ) a model to generate x given cx ; the latter can take multiple forms such as a second VAE or a generative adversarial network ( GAN ) ( Goodfellow et al. , 2014 ) . This approach is called synthesis-guided generative models ( SGM ) since it uses program synthesis to guide training . To leverage this framework , we have to instantiate ( i ) the space of relational constraints C , ( ii ) the synthesis algorithm A : X → C used to extract a program encoding the structure of x , and ( iii ) the architectures of pφ ( c | z ) , qφ̃ ( z | c ) , and pθ ( x | c ) . In prior work , Young et al . ( 2019 ) used heuristics specific to the the image domain to achieve these goals—in particular , they used ( i ) simple equality constraints on sub-regions of the image designed to capture 2D repeating patterns , ( ii ) a custom synthesis algorithm that greedily adds constraints in the data to the program , and ( iii ) a representation of cx as an image , in which case pθ is a generative model over images , and pφ , qφ̃ based on an encoding of c as a fixed-length vector . We design a synthesis algorithm that expresses the synthesis problem as a constrained combinatorial optimization problem , which it solves using an SMT solver called Z3 ( De Moura & Bjørner , 2008 ) . In terms of ( iii ) , our programs encode declarative constraints rather than imperative renderings , so the previous architectures of pφ , and qφ̃ can not be used . Instead , we use expert domain-specific heuristics , transformers ( Vaswani et al. , 2017 ) , or graph neural networks ( GNNs ) ( Kipf & Welling , 2017 ) for pφ and qφ̃ . For pθ , we propose several methods for imposing the constraints encoded by c when generating an example x .
This paper proposes a neural-symbolic deep generative model to generate music and poems. Compared to other natural language sentence generation tasks, songs and poems usually require some structural constraints, e.g., rhythm and rhymes. Therefore, their approach first generates a program represented as a set of relational constraints, then generates sequences that satisfy the constraints. During the training time, given a training example, i.e., a sequence, they formulate the program synthesis task as a combinatorial optimization problem, and thus they can find the required constraints using the Z3 solver. They use the SOTA generative models for both of the two sequence generation domains. They propose several variants of the generation approach, to ensure that the generated sequences satisfy the constraints. They evaluate their approach in terms of both the low-level and high-level structures. To measure the low-level structure, they compute the negative log likelihood of the SOTA generative models. To measure the high-level structure, they apply the Z3 solver to solve the relational constraints of each generated sequence, and train some discriminators to distinguish the generated sequences from the human-written ones in the dataset. For the poetry domain, they also evaluate the diversity of the generated sequences. Generally, the neural-symbolic approach generates sequences with better high-level structures, and the generated samples are more diverse.
SP:ca0c4bdb02f7d939fb6de38b6b446ced4b5984a0
Deep Curvature Suite
1 INTRODUCTION . The success of deep neural networks trained with gradient based optimisers in speech and object recognition ( LeCun et al. , 2015 ) , has led to an explosion in easy to use high performance software implementations . Automatic differentiation packages such as TensorFlow ( Abadi et al. , 2016 ) and PyTorch ( Paszke et al. , 2017 ) have become widely adopted . Higher level packages , such as Keras ( Chollet , 2015 ) allow practitioners users to state their model , dataset and optimiser in a few lines of code , effortlessly achieving state of the art performance . However , software for extracting second order information , representing the curvature of the loss at a point in weight space , has not kept abreast . Researchers aspiring to evaluate curvature information need to implement their own libraries , which are rarely shared or kept up to date . Naive implementations , which rely on full eigendecomposition ( cubic cost in the parameter count ) are computationally intractable for all but the smallest of models . Hence , researchers typically ignore curvature information or use highly optimistic approximations . Examples in the literature include the diagonal elements of the matrix or of a surrogate matrix , Chaudhari et al . ( 2016 ) ; Dangel et al . ( 2019 ) , which we show in AppendixE can be very misleading . 2 MOTIVATION . The curvature of the loss informs us about the local conditioning of the problem ( i.e the ratio of the largest to smallest eigenvalues λ1λP ) . This determines the rate of convergence for first order methods and informs us about the optimal learning and momentum rates ( Nesterov , 2013 ) . Hence easily accessible curvature information could allow practitioners to scale their learning rates in an optimal way throughout training , instead of relying on expert scheduling , we investigate this using our software in Section 5.2 . Research areas where curvature information features most prominently are analyses of the Loss Surface and Newton type optimization methods . 2.1 LOSS SURFACES . Recent neural network loss surfaces using full eigendecomposition ( Sagun et al. , 2016 ; 2017 ) have been limited to toy examples with less than five thousand parameters . Hence , loss surface visualisation of deep neural networks have often focused on two dimensional slices of random vectors ( Li et al. , 2017 ) or the changes in the loss traversing a set of random vectors drawn from the ddimensional Gaussian distribution ( Izmailov et al. , 2018 ) . It is not clear that the loss surfaces of modern expressive neural networks , containing millions or billions of dimensions , can be well captured in this manner . Small experiments have shown neural networks have a large rank degeneracy Sagun et al . ( 2016 ) with a small number of large outliers . However high dimensional concentration theorems Vershynin ( 2018 ) guarantee that even a large number of randomly sampled vectors are unlikely to encounter such outliers and hence have limited ability to discern the geometry between various solutions . Other works , that try to distinguish between flat and sharp minima have used the diagonal of the Fisher information matrix ( Chaudhari et al. , 2016 ) , an assumption we will challenge in this paper . Specifically we show in Appendix E , that diagonal approximations do not capture key properties in synthetic and real neural network examples . From a practical perspective , specific properties of the loss surface are not captured by the aforementioned approaches . Examples include the flatness as specified by the trace , Frobenius and spectral norm . These measures have been extensively used to characterise the generalisation of a solution found by SGD ( Wu et al. , 2018 ; Izmailov et al. , 2018 ; He et al. , 2019 ; Jastrzkebski et al. , 2017 ; 2018 ; Keskar et al. , 2016 ) . Under a Bayesian and minimum description length argument ( Hochreiter and Schmidhuber , 1997 ) flatter minima should generalise better than sharper minima . The magnitude of these outliers have been linked to poor generalisation performance Keskar et al . ( 2016 ) and as a consequences the generalisation benefits of large learning rate SGD Wu et al . ( 2018 ) ; Jastrzkebski et al . ( 2017 ) . These properties are extremely easy in principle to estimate , at a computational cost of a small multiple of gradient evaluations . However the calculation of these properties are not typically included in standard deep learning frameworks , which limits the ability of researchers to undertake such analysis . Other important areas of loss surface investigation include understanding the effectiveness of batch normalisation ( Ioffe and Szegedy , 2015 ) . Recent convergence proofs ( Santurkar et al. , 2018 ) bound the maximal eigenvalue of the Hessian with respect to the activations and bounds with respect to the weights on a per layer basis . Bounds on a per layer basis do not imply anything about the bounds of the entire Hessian and furthermore it has been argued that the full spectrum must be calculated to give insights on the alteration of the landscape ( Kohler et al. , 2018 ) . 2.2 SECOND ORDER OPTIMISATION METHODS . Second order optimisation methods solve the minimisation problem for the loss , L ( w ) ∈ R associated with parameters w ∈ RP×1 and perturbation δw ∈ RP×1 to the second order in Taylor expansion , δw∗ = argminδwL ( w + δw ) = argminδwL ( w + δw ) = −H̄−1∇L ( w ) . ( 1 ) Sometimes , such as in deep neural networks when the HessianH = ∇2L ( w ) ∈ RP×P is not positive definite , a positive definite surrogate is used . Note that Equation 1 is not lower bounded unless H is positive semi-definite . Often either a multiple of the identity is added ( known as damping ) to the Hessian ( H → H + γI ) Dauphin et al . ( 2014 ) or a surrogate positive definite approximation to the Hessian H̄ , such as the Generalised Gauss-Newton ( GGN ) ( Martens , 2010 ; Martens and Sutskever , 2012 ) is employed . To derive the GGN , we express the loss in terms of the activation L ( w ) = σ ( f ( w ) ) of the output of the final layer f ( w ) . Hence the elements of the Hessian can be written as H ( w ) ij = dy∑ k=0 dy∑ l=0 ∂2σ ( f ( w ) ) ∂fl ( w ) ∂fk ( w ) ∂fl ( w ) ∂wj ∂fk ( w ) ∂wi + dy∑ k=0 ∂σ ( f ( w ) ) ∂wj ∂2fk ( w ) ∂wj∂wi . ( 2 ) The first term on the LHS of Equation 2 is known as the Generalised Gauss-Newton matrix . Despite the success of second order optimisation methods using the GGN for difficult problems on which SGD is known to stall , such as recurrent neural networks ( Martens and Sutskever , 2012 ) , or auto-encoders ( Martens , 2016 ) . Researchers wanting to implement second order methods such as ( Vinyals and Povey , 2012 ; Martens and Sutskever , 2012 ; Dauphin et al. , 2014 ) face the aforementioned problems of difficult implementation . As a small side note , Bayesian neural networks using the Laplace approximation feature the Hessian inverse multiplied by a vector ( Bishop , 2006 ) . 2.3 CONTRIBUTIONS . We introduce our package , the Deep Curvature suite , a software package that allows analysis and visualisation of deep neural network curvature . The main features and functionalities of our package are : • Eigenspectrum analysis of the curvature matrices Powered by the Lanczos Meurant and Strakoš ( 2006 ) techniques implemented in GPyTorch ( Gardner et al. , 2018 ) and outlined in Section 3 , with a single random vector we use the Pearlmutter matrix-vector product trick Pearlmutter ( 1994 ) for fast inference of the eigenvalues and eigenvectors of the common curvature matrices of the deep neural networks . In addition to the standard Hessian matrix , we also include the feature for inference of the eigen-information of the Generalised GaussNewton matrix , a commonly used positive-definite surrogate to Hessian1 . • Advanced Statistics of Networks In addition to the commonly used statistics to evaluate network training and performance such as the training and testing losses and accuracy , we support computations of more advanced statistics : For example , we support squared mean and variance of gradients and Hessians ( and GGN ) , squared norms of Hessian and GGN , L2 and L-inf norms of the network weights and etc . These statistics are useful and relevant for a wide range of purposes such as the designs of second-order optimisers and network architecture . • Visualisations For all main features above , we include accompanying visualisation tools . In addition , with the eigen-information obtained , we also feature visualisations of the loss landscape by studying the sensitivity of the neural network to perturbations of weights . • Second Order Optimisation We include out of the box stochastic lanczos second order optimisers which use the absolute Hessian Dauphin et al . ( 2014 ) or the Generalised Gauss Newton Martens ( 2010 ) as curvature matrices • Batch Normalisation Support Our code allows for the use of batch normalisation ( Ioffe and Szegedy , 2015 ) in neural networks , which is integrated by default on most modern convolutional neural networks . Since the way in watch batch normalisation is calculated has a big effect on the resulting curvature calculations and can be dependent on the order in which the samples are processed , we offer two models of evaluation . Train mode which depends on the order in which the samples are processed and is similar to what the optimiser sees during training and evaluation mode , in which the statistics are pre-computed and hence invariant to sample shuffling . We expand on the differences between these methods in Appendix A . Our software makes calculating and visualising curvature information as simple as calculating the gradient at a saved checkpoint in weight-space . The computational complexity of our approach is O ( mP ) , where m is the number of Lanczos steps 2 and P is the number of model parameters . This in stark contrast full exact eigendecomposition which has a numerical cost of O ( P 3 ) , which is infeasible for large neural networks . 2.4 RELATED WORK . Recent work making curvature information more available using diagonal approximations , disallows the use of batch normalisation ( Dangel et al. , 2019 ) . Our software extends seamlessly to support 1The computation of the GGN-vector product is similar with the computational cost of two backward passes in the network . Also , GGN uses forward-mode automatic differentiation ( FMAD ) in addition to the commonly employed backward-mode automatic differentiation ( RMAD ) . In the current PyTorch framework , the FMAD operation can be achieved using two equivalent RMAD operations . 2which corresponds to the number of moments of the underlying Hessian/GGN density which we wish to match Functionality Deep Curvature Suite PyHessian Hessian Density Estimation 3 3 GGN Density Estimation 3 7 Loss Surface Visualisation 3 3 Gradient Variance 3 7 Hessian/GGN Variance 3 7 Second Order Optimisers 3 7 Table 1 : Table of Contributions : comparison between our released software and that of another PyTorch based Hessian tool PyHessian batch normalization In Appendix E.5 we explicitly compare against their diagonal MC approximations on synthetic and real neural network examples and find these approximations inadequate for spectral analysis . Independent work has also uses the Lanczos algorithm for Hessian computation Yao et al . ( 2019 ) ; Ghorbani et al . ( 2019 ) ; Papyan ( 2018 ) ; Izmailov et al . ( 2019 ) . We compare the functionality of our package to that of PyHessian Yao et al . ( 2018 ) in Table 1 . One major extra functionality we offer is the calculation of the GGN . For common activatios and loss functions , such as the cross-entropy loss and sigmoid activation , the generalised Gauss-Newton is equivalent to the Fisher information matrix ( Pascanu and Bengio , 2013 ) . Hence this approximation to the Hessian is interesting in its own right and many theoretical analyses , consider the generalised Gauss-Newton or Fisher information matrices as opposed to the Hessian Pennington and Worah ( 2018 ) ; Karakida et al . ( 2019 ) ; Papyan ( 2019 ) . Hence accessing the GGN spectrum could be a major asset to researchers . Another extra functionality we offer is the calculation of the Hessian/GGN variance . This quantity has been used to derive optimal learning rates in Wu et al . ( 2018 ) and to predict the effect of minibatching on curvature using a random matrix theory model ( Granziol , 2020 ) . We include an example figure where the theoretical prediction is validated using our software in Figure 1 .
This paper proposes a software package to ease and provide a standard way for Hessian-related computation, both for loss analysis and second order optimization. It also provides analysis on why Lanczos algorithm is a better choice to estimate Hessian eigenvalue compared to Power Iterations. Finally, it empirically shows the advantage of using Hessian approximation that goes beyond diagonal approximation for spectrum computation.
SP:37bd7b6bf0f90eb24e82b831b5fd8c57c3b09142
Deep Curvature Suite
1 INTRODUCTION . The success of deep neural networks trained with gradient based optimisers in speech and object recognition ( LeCun et al. , 2015 ) , has led to an explosion in easy to use high performance software implementations . Automatic differentiation packages such as TensorFlow ( Abadi et al. , 2016 ) and PyTorch ( Paszke et al. , 2017 ) have become widely adopted . Higher level packages , such as Keras ( Chollet , 2015 ) allow practitioners users to state their model , dataset and optimiser in a few lines of code , effortlessly achieving state of the art performance . However , software for extracting second order information , representing the curvature of the loss at a point in weight space , has not kept abreast . Researchers aspiring to evaluate curvature information need to implement their own libraries , which are rarely shared or kept up to date . Naive implementations , which rely on full eigendecomposition ( cubic cost in the parameter count ) are computationally intractable for all but the smallest of models . Hence , researchers typically ignore curvature information or use highly optimistic approximations . Examples in the literature include the diagonal elements of the matrix or of a surrogate matrix , Chaudhari et al . ( 2016 ) ; Dangel et al . ( 2019 ) , which we show in AppendixE can be very misleading . 2 MOTIVATION . The curvature of the loss informs us about the local conditioning of the problem ( i.e the ratio of the largest to smallest eigenvalues λ1λP ) . This determines the rate of convergence for first order methods and informs us about the optimal learning and momentum rates ( Nesterov , 2013 ) . Hence easily accessible curvature information could allow practitioners to scale their learning rates in an optimal way throughout training , instead of relying on expert scheduling , we investigate this using our software in Section 5.2 . Research areas where curvature information features most prominently are analyses of the Loss Surface and Newton type optimization methods . 2.1 LOSS SURFACES . Recent neural network loss surfaces using full eigendecomposition ( Sagun et al. , 2016 ; 2017 ) have been limited to toy examples with less than five thousand parameters . Hence , loss surface visualisation of deep neural networks have often focused on two dimensional slices of random vectors ( Li et al. , 2017 ) or the changes in the loss traversing a set of random vectors drawn from the ddimensional Gaussian distribution ( Izmailov et al. , 2018 ) . It is not clear that the loss surfaces of modern expressive neural networks , containing millions or billions of dimensions , can be well captured in this manner . Small experiments have shown neural networks have a large rank degeneracy Sagun et al . ( 2016 ) with a small number of large outliers . However high dimensional concentration theorems Vershynin ( 2018 ) guarantee that even a large number of randomly sampled vectors are unlikely to encounter such outliers and hence have limited ability to discern the geometry between various solutions . Other works , that try to distinguish between flat and sharp minima have used the diagonal of the Fisher information matrix ( Chaudhari et al. , 2016 ) , an assumption we will challenge in this paper . Specifically we show in Appendix E , that diagonal approximations do not capture key properties in synthetic and real neural network examples . From a practical perspective , specific properties of the loss surface are not captured by the aforementioned approaches . Examples include the flatness as specified by the trace , Frobenius and spectral norm . These measures have been extensively used to characterise the generalisation of a solution found by SGD ( Wu et al. , 2018 ; Izmailov et al. , 2018 ; He et al. , 2019 ; Jastrzkebski et al. , 2017 ; 2018 ; Keskar et al. , 2016 ) . Under a Bayesian and minimum description length argument ( Hochreiter and Schmidhuber , 1997 ) flatter minima should generalise better than sharper minima . The magnitude of these outliers have been linked to poor generalisation performance Keskar et al . ( 2016 ) and as a consequences the generalisation benefits of large learning rate SGD Wu et al . ( 2018 ) ; Jastrzkebski et al . ( 2017 ) . These properties are extremely easy in principle to estimate , at a computational cost of a small multiple of gradient evaluations . However the calculation of these properties are not typically included in standard deep learning frameworks , which limits the ability of researchers to undertake such analysis . Other important areas of loss surface investigation include understanding the effectiveness of batch normalisation ( Ioffe and Szegedy , 2015 ) . Recent convergence proofs ( Santurkar et al. , 2018 ) bound the maximal eigenvalue of the Hessian with respect to the activations and bounds with respect to the weights on a per layer basis . Bounds on a per layer basis do not imply anything about the bounds of the entire Hessian and furthermore it has been argued that the full spectrum must be calculated to give insights on the alteration of the landscape ( Kohler et al. , 2018 ) . 2.2 SECOND ORDER OPTIMISATION METHODS . Second order optimisation methods solve the minimisation problem for the loss , L ( w ) ∈ R associated with parameters w ∈ RP×1 and perturbation δw ∈ RP×1 to the second order in Taylor expansion , δw∗ = argminδwL ( w + δw ) = argminδwL ( w + δw ) = −H̄−1∇L ( w ) . ( 1 ) Sometimes , such as in deep neural networks when the HessianH = ∇2L ( w ) ∈ RP×P is not positive definite , a positive definite surrogate is used . Note that Equation 1 is not lower bounded unless H is positive semi-definite . Often either a multiple of the identity is added ( known as damping ) to the Hessian ( H → H + γI ) Dauphin et al . ( 2014 ) or a surrogate positive definite approximation to the Hessian H̄ , such as the Generalised Gauss-Newton ( GGN ) ( Martens , 2010 ; Martens and Sutskever , 2012 ) is employed . To derive the GGN , we express the loss in terms of the activation L ( w ) = σ ( f ( w ) ) of the output of the final layer f ( w ) . Hence the elements of the Hessian can be written as H ( w ) ij = dy∑ k=0 dy∑ l=0 ∂2σ ( f ( w ) ) ∂fl ( w ) ∂fk ( w ) ∂fl ( w ) ∂wj ∂fk ( w ) ∂wi + dy∑ k=0 ∂σ ( f ( w ) ) ∂wj ∂2fk ( w ) ∂wj∂wi . ( 2 ) The first term on the LHS of Equation 2 is known as the Generalised Gauss-Newton matrix . Despite the success of second order optimisation methods using the GGN for difficult problems on which SGD is known to stall , such as recurrent neural networks ( Martens and Sutskever , 2012 ) , or auto-encoders ( Martens , 2016 ) . Researchers wanting to implement second order methods such as ( Vinyals and Povey , 2012 ; Martens and Sutskever , 2012 ; Dauphin et al. , 2014 ) face the aforementioned problems of difficult implementation . As a small side note , Bayesian neural networks using the Laplace approximation feature the Hessian inverse multiplied by a vector ( Bishop , 2006 ) . 2.3 CONTRIBUTIONS . We introduce our package , the Deep Curvature suite , a software package that allows analysis and visualisation of deep neural network curvature . The main features and functionalities of our package are : • Eigenspectrum analysis of the curvature matrices Powered by the Lanczos Meurant and Strakoš ( 2006 ) techniques implemented in GPyTorch ( Gardner et al. , 2018 ) and outlined in Section 3 , with a single random vector we use the Pearlmutter matrix-vector product trick Pearlmutter ( 1994 ) for fast inference of the eigenvalues and eigenvectors of the common curvature matrices of the deep neural networks . In addition to the standard Hessian matrix , we also include the feature for inference of the eigen-information of the Generalised GaussNewton matrix , a commonly used positive-definite surrogate to Hessian1 . • Advanced Statistics of Networks In addition to the commonly used statistics to evaluate network training and performance such as the training and testing losses and accuracy , we support computations of more advanced statistics : For example , we support squared mean and variance of gradients and Hessians ( and GGN ) , squared norms of Hessian and GGN , L2 and L-inf norms of the network weights and etc . These statistics are useful and relevant for a wide range of purposes such as the designs of second-order optimisers and network architecture . • Visualisations For all main features above , we include accompanying visualisation tools . In addition , with the eigen-information obtained , we also feature visualisations of the loss landscape by studying the sensitivity of the neural network to perturbations of weights . • Second Order Optimisation We include out of the box stochastic lanczos second order optimisers which use the absolute Hessian Dauphin et al . ( 2014 ) or the Generalised Gauss Newton Martens ( 2010 ) as curvature matrices • Batch Normalisation Support Our code allows for the use of batch normalisation ( Ioffe and Szegedy , 2015 ) in neural networks , which is integrated by default on most modern convolutional neural networks . Since the way in watch batch normalisation is calculated has a big effect on the resulting curvature calculations and can be dependent on the order in which the samples are processed , we offer two models of evaluation . Train mode which depends on the order in which the samples are processed and is similar to what the optimiser sees during training and evaluation mode , in which the statistics are pre-computed and hence invariant to sample shuffling . We expand on the differences between these methods in Appendix A . Our software makes calculating and visualising curvature information as simple as calculating the gradient at a saved checkpoint in weight-space . The computational complexity of our approach is O ( mP ) , where m is the number of Lanczos steps 2 and P is the number of model parameters . This in stark contrast full exact eigendecomposition which has a numerical cost of O ( P 3 ) , which is infeasible for large neural networks . 2.4 RELATED WORK . Recent work making curvature information more available using diagonal approximations , disallows the use of batch normalisation ( Dangel et al. , 2019 ) . Our software extends seamlessly to support 1The computation of the GGN-vector product is similar with the computational cost of two backward passes in the network . Also , GGN uses forward-mode automatic differentiation ( FMAD ) in addition to the commonly employed backward-mode automatic differentiation ( RMAD ) . In the current PyTorch framework , the FMAD operation can be achieved using two equivalent RMAD operations . 2which corresponds to the number of moments of the underlying Hessian/GGN density which we wish to match Functionality Deep Curvature Suite PyHessian Hessian Density Estimation 3 3 GGN Density Estimation 3 7 Loss Surface Visualisation 3 3 Gradient Variance 3 7 Hessian/GGN Variance 3 7 Second Order Optimisers 3 7 Table 1 : Table of Contributions : comparison between our released software and that of another PyTorch based Hessian tool PyHessian batch normalization In Appendix E.5 we explicitly compare against their diagonal MC approximations on synthetic and real neural network examples and find these approximations inadequate for spectral analysis . Independent work has also uses the Lanczos algorithm for Hessian computation Yao et al . ( 2019 ) ; Ghorbani et al . ( 2019 ) ; Papyan ( 2018 ) ; Izmailov et al . ( 2019 ) . We compare the functionality of our package to that of PyHessian Yao et al . ( 2018 ) in Table 1 . One major extra functionality we offer is the calculation of the GGN . For common activatios and loss functions , such as the cross-entropy loss and sigmoid activation , the generalised Gauss-Newton is equivalent to the Fisher information matrix ( Pascanu and Bengio , 2013 ) . Hence this approximation to the Hessian is interesting in its own right and many theoretical analyses , consider the generalised Gauss-Newton or Fisher information matrices as opposed to the Hessian Pennington and Worah ( 2018 ) ; Karakida et al . ( 2019 ) ; Papyan ( 2019 ) . Hence accessing the GGN spectrum could be a major asset to researchers . Another extra functionality we offer is the calculation of the Hessian/GGN variance . This quantity has been used to derive optimal learning rates in Wu et al . ( 2018 ) and to predict the effect of minibatching on curvature using a random matrix theory model ( Granziol , 2020 ) . We include an example figure where the theoretical prediction is validated using our software in Figure 1 .
- This paper introduces a package for computing the second-order information of neural networks based on the Lanczos algorithm. The authors showcase the usages of the package with 1) visualizing the eigenspectrum of the curvature matrix; 2)visualizing the loss surface along with a specific direction, and 3) comparisons between different optimizers. Also, the authors claimed that they address several misconceptions about the Lanczos algorithm.
SP:37bd7b6bf0f90eb24e82b831b5fd8c57c3b09142
Multi-scale Network Architecture Search for Object Detection
1 INTRODUCTION . Recognizing and localizing objects at vastly different scales is a fundamental challenge in object detection . Detection performance for objects with different scales is highly related to features with different properties such as feature resolution , receptive fields , and feature fusion ways . The key to solving the multi-scale problem in object detection is how to build a multi-scale network that has proper high-level semantic features for objects with different scales . A recent work in object detection Feature Pyramid Networks ( FPN ) ( Lin et al. , 2017 ) has achieved remarkable success in multi-scale feature design and has been commonly used by many modern object detectors ( He et al. , 2017 ; Lin et al. , 2020 ; Lu et al. , 2019 ) . FPN extracts multi-scale intermediate features from the encoder network and assigns objects grouped by scales to corresponding features according to a heuristic rule . Another prevalent detection framework , SSD ( Liu et al. , 2016 ) , conducts feature generation by a lighter encoder network without upsampling operators . The basic idea to deal with the multi-scale detection problem can be summarized as below . Given the input image , a series of feature maps with the various resolution are generated to detect objects grouped by scale range . We note it as multi-scale feature production . In FPN and its variants , the multi-scale feature production is split into two steps , feature generation and feature utilization . In terms of feature generation , an encoder network composed of blocks provides features with different scales . And the strategy of feature utilization determines the rule of assigning objects to feature maps . These two steps are closely related to each other . Although FPN has achieved promising results on multi-scale object detection tasks , the production of multi-scale features is quite hand-crafted and relies heavily on the experiences of human experts . More specifically , network architectures of FPN are based on a downsample-upsample architecture which may not be effective enough . By changing the downsampling and upsampling operation ’ s positions and numbers , we could obtain many other candidates to generate different multi-scale features . Also , the predefined rule of feature utilization is very empirical and other alternatives may lead to better performance . Therefore we wonder : Can we find network architectures that can build better semantic feature representation for multiple scales ? The answer is yes . Recent advances in neural architecture search have shown promising results compared with handcrafted architecture by human experts ( Zoph et al. , 2018 ; Liu et al. , 2019b ; Cai et al. , 2019 ; Guo et al. , 2019 ) . Several works have also focused on neural architecture search in object detection tasks ( Chen et al. , 2019 ; Ghiasi et al. , 2019 ; Du et al. , 2019 ) , but generating and utilizing multi-scale features are still not well explored . DetNAS ( Chen et al. , 2019 ) adopts the method mainly designed on image classification to search the operations of backbone networks in object detectors . NASFPN ( Ghiasi et al. , 2019 ) focuses on searching for better feature-fusion connections in the neck part of FPN . NAS-FPN doesn ’ t optimize the whole encoder network and still relies on predefined backbone architecture . Recently SpineNet ( Du et al. , 2019 ) proposes a search method with scalepermuted features and cross-scale connections by reinforcement learning , but the search cost is quite large . All these previous works focus on designing better neural network architectures to generate better features given a fixed feature selection strategy . However , they fail to conduct a complete flexible multi-scale feature production strategy . In this paper , we propose a new method to take into account of both aspects and build detection networks with the strong and proper multi-scale feature production strategy by neural architecture search . For feature generation , we put forward a network stride search method to generate multiple feature representations for different scales . Different from the scale-decreasing-increasing architecture of FPN , the scale of our networks can decrease or increase at each block , as illustrated in Figure 1 . By stride search for each block , we could significantly explore a wide range of possible feature generation designs of multi-resolution networks . Most backbones of object detectors are originally designed on image classification without multi-scale problems . However , stride configuration in the encoder network would be optimized in the context of the multi-scale task . Moreover , more complex cross-scale feature fusions might appear according to more complex internal scale changes . For feature utilization , we change the previous one-to-one mapping strategy into a more flexible feature selection . Since each group with objects of the same scale range owns one detection head , feature utilization is implemented by selecting proper features for detection heads . Objects of different scale ranges might be assigned to the same feature map . It is not possible in previous methods , as shown in Figure 1 ( b ) . By jointly optimizing feature generation and utilization of multi-scale features , we search for flexible but complete multi-scale feature production strategies . Extensive experiments demonstrate complete multi-scale feature production search is critical to building strong and proper semantic features for object detection with different scales . On challenging COCO dataset ( Lin et al. , 2014 ) , our method obtains a 2.6 % , 1.5 % , 1.2 % mAP improvement with similar FLOPs as ResNet18-FPN , ResNet34FPN , ResNet50-FPN . 2 RELATED WORK . Neural Architecture Search Neural Architecture Search aims to design better network architectures automatically . RL-based methods ( Zoph et al. , 2018 ; Zoph & Le , 2017 ) have achieved great success despite a huge computation cost . In differentiable algorithms ( Liu et al. , 2019b ; Cai et al. , 2019 ) , architecture parameters are employed and operators in the search space are considered as the weighted sum of candidate operators . There exist difficulties to deal with operators with different strides . Super-nets , acting as the collection of weights shared by all the sub-architectures , and evolutionary search are involved in one-shot NAS ( Guo et al. , 2019 ; Bender et al. , 2018 ) . But it ’ s difficult to ensure strong correlations between one-shot and stand-alone performances of the sub-architectures . Multi-scale Object Detection SSD ( Liu et al. , 2016 ) uses multi-scale features generated by different stages of the backbone network to detect objects of different scales . Feature pyramid architectures are utilized in FPN ( Lin et al. , 2017 ) and RetinaNet ( Lin et al. , 2020 ) to obtain multi-scale features . SNIP ( Singh & Davis , 2018 ) includes the image pyramid architecture to deal with multi-scale detection . Frameworks with multi-scale features are prevalent as objects of different scales appear in one image . Neural Architecture Search on Object Detection DetNAS ( Chen et al. , 2019 ) , NAS-FCOS ( Wang et al. , 2019 ) and Auto-FPN ( Xu et al. , 2019 ) focus on the architecture of the top-down pathway and feature fusion . SM-NAS ( Yao et al. , 2019 ) and CR-NAS ( Liang et al. , 2020 ) try to adjust the computation occupied by different parts of detectors . Also , there are several works aiming to improve FPN using NAS . NAS-FPN ( Ghiasi et al. , 2019 ) improves detection performance by searching for better connections within the feature pyramid network . It is limited without modification to the overall encoder architecture . And it fails to take the multi-scale feature utilization into account . EfficientDet ( Tan et al. , 2019 ) and Auto-FPN ( Xu et al. , 2019 ) search better feature fusion for FPN with differentiable methods . Other relative works like Liu et al . ( 2019a ) conduct similar modifications . Recently , SpineNet ( Du et al. , 2019 ) proposes a backbone search method with scale-permuted features and cross-scale connections by reinforcement learning . Our work has several major differences from it . First , the search space of MSNAS is designed that each operator in the network can downsample or upsample instead of permutation , which builds a much larger search space than SpineNet . Second , the complete multi-scale feature production is considered in our work , while SpineNet only focuses on the architecture of the encoder network . Lastly , our method is based on the one-shot search method instead of reinforcement learning in SpineNet . Our method is much more efficient and requires much less computation cost than SpineNet . 3 METHOD . We start by discussing multi-scale feature production for the object detection network in Section 3.1 . In Section 3.2 we will introduce how to build the search space and search proper stride in detection networks to obtain better multi-scale features . In Section 3.3 , how to search the appropriate strategy of feature utilization is presented . Finally , details about super-net training and search strategy are described in Section 3.4 . 3.1 FEATURE PRODUCTION FOR DETECTION NETWORK . In this section , we ’ ll discuss the production of multi-scale features and define the problem in detail . As noted above , the basic idea of handling the multi-scale detection problem can be summarized as feature production . In feature production , the input image is first encoded into a series of feature maps with various resolutions . Then the objects are detected based on the features according to their scales . One method is to produce the feature for each scale range by one neural network , like the featurized image pyramid discussed in Lin et al . ( 2017 ) . Variants include utilizing the image pyramid , like SNIP ( Singh & Davis , 2018 ) . However , we employ only one neural network and obtain multi-scale features from intermediate features of the network . Because deep neural networks are experts in encoding the image into features . And they are considered to be able to encode information of different scales into features with different resolutions . Then we face the problem of how to utilize these features since there are N features available for K object groups . Therefore , it is reasonable to split feature production into feature generation and feature utilization . To be more specific , the problem of multi-scale feature production can be defined as Equation 1 . When we divide the problem into feature generation and feature utilization , as in Equation 2 and Equation 3 , φ is approximated by g ◦ f . φ : R3×W×H → { RHi×Wi×Hi } K ( 1 ) f : R3×W×H → { RHi×Wi×Hi } N ( 2 ) g : { RHi×Wi×Hi } N → { RHi×Wi×Hi } K ( 3 ) And it is likely that only optimizing feature generation , as previous works do , is not optimal . So instead of optimizing feature generation for all the feature utilization strategies , we jointly optimize feature generation and utilization as a whole . 3.2 FEATURE GENERATION . Resolution of feature maps in one network changes with downsampling or upsampling operators . The network architectures of FPN follow the downsampling-upsampling style , as Figure 1 ( a ) shows . By encouraging a more flexible design of the scale-changing operation ’ s positions and numbers , we could obtain many more promising candidates to generate better multi-scale features . We implement that by searching the stride of each block in the network . Search space By deconstructing and generalizing the prevalent feature pyramid architecture , the basic search space is built as a stride-variable straight structure . A super-net of MSNAS with the depth of N consists of N mixed-blocks , MB1 , MB2 , ... , MBN . For each mixed-block , three possible strides are provided , i.e . 0.5 , 1 , and 2 . The block whose stride equals to 0.5 is implemented as an upsampling block with an interpolation operator followed by a convolution to double the width and height of the feature map . Blocks that don ’ t change the resolution of the feature map are referred to as normal blocks . The resolution of the feature output by one mixed-block could be twice , half or the same as the input feature , as illustrated in Figure 2 ( a ) . Considering operators with different strides within a mixed-block and the variation of sizes output from different operators in one mixed-block , the super-net is designed as a path-wise structure like Guo et al . ( 2019 ) . One path in the super-net is treated as valid if none of the blocks output feature larger than a quarter or smaller than 1/64 of the input image . Invalid paths are removed either in the training process of super-net or the sampling during the evolutionary search . Lateral connections Lateral connections are built according to current sub-architecture , as Figure 1 ( b ) shows . One additional 1×1 lateral convolution attached after every mix-block is available for latter cross-block connections . In scale-decreasing architectures , blocks can be grouped by resolution of output features . Each group is notated as one stage . Similarly , we refer stage to a group of adjacent blocks with the same output resolution , e.g . one downsampling or upsampling block and following normal blocks . The feature map of the last mix-block at one stage is merged with the lateral feature by element-wise addition as Equation 4-Equation 6 shows . xi =MBi ( xi−1 ) + lati ( 4 ) lati = { LateralConvri ( xri ) , if ( stridei+1 6= 1 ) or ( i = N − 1 ) 0 , otherwise ( 5 ) where ri = max ( { k | ( ∏ k < j≤i stridej = 1 ) and ( stridek+1 6= 1 ) } ) ( 6 ) where lati means the lateral connection of block i to combine with . If block i is the last block of a stage or the end of the encoder network as described in Equation5 , lati is generated by lateral convolution LateralConvri . Among blocks with output feature of the same resolution as block i , block ri is the nearest one at a different stage . It can be regarded as an extensive version of lateral connections in the original FPN structure .
This submission works on the task of architecture search for object detection. The authors focus on two components: how to produce multi-scale features and how to use multi-scale features. The authors formalized a simple search space, and applied an evolution-based search algorithm. Experiments show the proposed searching algorithm is able to outperform the FPN baselines with various (small) backbones.
SP:648c9f61876219050edc481d57891ec3465617d3
Multi-scale Network Architecture Search for Object Detection
1 INTRODUCTION . Recognizing and localizing objects at vastly different scales is a fundamental challenge in object detection . Detection performance for objects with different scales is highly related to features with different properties such as feature resolution , receptive fields , and feature fusion ways . The key to solving the multi-scale problem in object detection is how to build a multi-scale network that has proper high-level semantic features for objects with different scales . A recent work in object detection Feature Pyramid Networks ( FPN ) ( Lin et al. , 2017 ) has achieved remarkable success in multi-scale feature design and has been commonly used by many modern object detectors ( He et al. , 2017 ; Lin et al. , 2020 ; Lu et al. , 2019 ) . FPN extracts multi-scale intermediate features from the encoder network and assigns objects grouped by scales to corresponding features according to a heuristic rule . Another prevalent detection framework , SSD ( Liu et al. , 2016 ) , conducts feature generation by a lighter encoder network without upsampling operators . The basic idea to deal with the multi-scale detection problem can be summarized as below . Given the input image , a series of feature maps with the various resolution are generated to detect objects grouped by scale range . We note it as multi-scale feature production . In FPN and its variants , the multi-scale feature production is split into two steps , feature generation and feature utilization . In terms of feature generation , an encoder network composed of blocks provides features with different scales . And the strategy of feature utilization determines the rule of assigning objects to feature maps . These two steps are closely related to each other . Although FPN has achieved promising results on multi-scale object detection tasks , the production of multi-scale features is quite hand-crafted and relies heavily on the experiences of human experts . More specifically , network architectures of FPN are based on a downsample-upsample architecture which may not be effective enough . By changing the downsampling and upsampling operation ’ s positions and numbers , we could obtain many other candidates to generate different multi-scale features . Also , the predefined rule of feature utilization is very empirical and other alternatives may lead to better performance . Therefore we wonder : Can we find network architectures that can build better semantic feature representation for multiple scales ? The answer is yes . Recent advances in neural architecture search have shown promising results compared with handcrafted architecture by human experts ( Zoph et al. , 2018 ; Liu et al. , 2019b ; Cai et al. , 2019 ; Guo et al. , 2019 ) . Several works have also focused on neural architecture search in object detection tasks ( Chen et al. , 2019 ; Ghiasi et al. , 2019 ; Du et al. , 2019 ) , but generating and utilizing multi-scale features are still not well explored . DetNAS ( Chen et al. , 2019 ) adopts the method mainly designed on image classification to search the operations of backbone networks in object detectors . NASFPN ( Ghiasi et al. , 2019 ) focuses on searching for better feature-fusion connections in the neck part of FPN . NAS-FPN doesn ’ t optimize the whole encoder network and still relies on predefined backbone architecture . Recently SpineNet ( Du et al. , 2019 ) proposes a search method with scalepermuted features and cross-scale connections by reinforcement learning , but the search cost is quite large . All these previous works focus on designing better neural network architectures to generate better features given a fixed feature selection strategy . However , they fail to conduct a complete flexible multi-scale feature production strategy . In this paper , we propose a new method to take into account of both aspects and build detection networks with the strong and proper multi-scale feature production strategy by neural architecture search . For feature generation , we put forward a network stride search method to generate multiple feature representations for different scales . Different from the scale-decreasing-increasing architecture of FPN , the scale of our networks can decrease or increase at each block , as illustrated in Figure 1 . By stride search for each block , we could significantly explore a wide range of possible feature generation designs of multi-resolution networks . Most backbones of object detectors are originally designed on image classification without multi-scale problems . However , stride configuration in the encoder network would be optimized in the context of the multi-scale task . Moreover , more complex cross-scale feature fusions might appear according to more complex internal scale changes . For feature utilization , we change the previous one-to-one mapping strategy into a more flexible feature selection . Since each group with objects of the same scale range owns one detection head , feature utilization is implemented by selecting proper features for detection heads . Objects of different scale ranges might be assigned to the same feature map . It is not possible in previous methods , as shown in Figure 1 ( b ) . By jointly optimizing feature generation and utilization of multi-scale features , we search for flexible but complete multi-scale feature production strategies . Extensive experiments demonstrate complete multi-scale feature production search is critical to building strong and proper semantic features for object detection with different scales . On challenging COCO dataset ( Lin et al. , 2014 ) , our method obtains a 2.6 % , 1.5 % , 1.2 % mAP improvement with similar FLOPs as ResNet18-FPN , ResNet34FPN , ResNet50-FPN . 2 RELATED WORK . Neural Architecture Search Neural Architecture Search aims to design better network architectures automatically . RL-based methods ( Zoph et al. , 2018 ; Zoph & Le , 2017 ) have achieved great success despite a huge computation cost . In differentiable algorithms ( Liu et al. , 2019b ; Cai et al. , 2019 ) , architecture parameters are employed and operators in the search space are considered as the weighted sum of candidate operators . There exist difficulties to deal with operators with different strides . Super-nets , acting as the collection of weights shared by all the sub-architectures , and evolutionary search are involved in one-shot NAS ( Guo et al. , 2019 ; Bender et al. , 2018 ) . But it ’ s difficult to ensure strong correlations between one-shot and stand-alone performances of the sub-architectures . Multi-scale Object Detection SSD ( Liu et al. , 2016 ) uses multi-scale features generated by different stages of the backbone network to detect objects of different scales . Feature pyramid architectures are utilized in FPN ( Lin et al. , 2017 ) and RetinaNet ( Lin et al. , 2020 ) to obtain multi-scale features . SNIP ( Singh & Davis , 2018 ) includes the image pyramid architecture to deal with multi-scale detection . Frameworks with multi-scale features are prevalent as objects of different scales appear in one image . Neural Architecture Search on Object Detection DetNAS ( Chen et al. , 2019 ) , NAS-FCOS ( Wang et al. , 2019 ) and Auto-FPN ( Xu et al. , 2019 ) focus on the architecture of the top-down pathway and feature fusion . SM-NAS ( Yao et al. , 2019 ) and CR-NAS ( Liang et al. , 2020 ) try to adjust the computation occupied by different parts of detectors . Also , there are several works aiming to improve FPN using NAS . NAS-FPN ( Ghiasi et al. , 2019 ) improves detection performance by searching for better connections within the feature pyramid network . It is limited without modification to the overall encoder architecture . And it fails to take the multi-scale feature utilization into account . EfficientDet ( Tan et al. , 2019 ) and Auto-FPN ( Xu et al. , 2019 ) search better feature fusion for FPN with differentiable methods . Other relative works like Liu et al . ( 2019a ) conduct similar modifications . Recently , SpineNet ( Du et al. , 2019 ) proposes a backbone search method with scale-permuted features and cross-scale connections by reinforcement learning . Our work has several major differences from it . First , the search space of MSNAS is designed that each operator in the network can downsample or upsample instead of permutation , which builds a much larger search space than SpineNet . Second , the complete multi-scale feature production is considered in our work , while SpineNet only focuses on the architecture of the encoder network . Lastly , our method is based on the one-shot search method instead of reinforcement learning in SpineNet . Our method is much more efficient and requires much less computation cost than SpineNet . 3 METHOD . We start by discussing multi-scale feature production for the object detection network in Section 3.1 . In Section 3.2 we will introduce how to build the search space and search proper stride in detection networks to obtain better multi-scale features . In Section 3.3 , how to search the appropriate strategy of feature utilization is presented . Finally , details about super-net training and search strategy are described in Section 3.4 . 3.1 FEATURE PRODUCTION FOR DETECTION NETWORK . In this section , we ’ ll discuss the production of multi-scale features and define the problem in detail . As noted above , the basic idea of handling the multi-scale detection problem can be summarized as feature production . In feature production , the input image is first encoded into a series of feature maps with various resolutions . Then the objects are detected based on the features according to their scales . One method is to produce the feature for each scale range by one neural network , like the featurized image pyramid discussed in Lin et al . ( 2017 ) . Variants include utilizing the image pyramid , like SNIP ( Singh & Davis , 2018 ) . However , we employ only one neural network and obtain multi-scale features from intermediate features of the network . Because deep neural networks are experts in encoding the image into features . And they are considered to be able to encode information of different scales into features with different resolutions . Then we face the problem of how to utilize these features since there are N features available for K object groups . Therefore , it is reasonable to split feature production into feature generation and feature utilization . To be more specific , the problem of multi-scale feature production can be defined as Equation 1 . When we divide the problem into feature generation and feature utilization , as in Equation 2 and Equation 3 , φ is approximated by g ◦ f . φ : R3×W×H → { RHi×Wi×Hi } K ( 1 ) f : R3×W×H → { RHi×Wi×Hi } N ( 2 ) g : { RHi×Wi×Hi } N → { RHi×Wi×Hi } K ( 3 ) And it is likely that only optimizing feature generation , as previous works do , is not optimal . So instead of optimizing feature generation for all the feature utilization strategies , we jointly optimize feature generation and utilization as a whole . 3.2 FEATURE GENERATION . Resolution of feature maps in one network changes with downsampling or upsampling operators . The network architectures of FPN follow the downsampling-upsampling style , as Figure 1 ( a ) shows . By encouraging a more flexible design of the scale-changing operation ’ s positions and numbers , we could obtain many more promising candidates to generate better multi-scale features . We implement that by searching the stride of each block in the network . Search space By deconstructing and generalizing the prevalent feature pyramid architecture , the basic search space is built as a stride-variable straight structure . A super-net of MSNAS with the depth of N consists of N mixed-blocks , MB1 , MB2 , ... , MBN . For each mixed-block , three possible strides are provided , i.e . 0.5 , 1 , and 2 . The block whose stride equals to 0.5 is implemented as an upsampling block with an interpolation operator followed by a convolution to double the width and height of the feature map . Blocks that don ’ t change the resolution of the feature map are referred to as normal blocks . The resolution of the feature output by one mixed-block could be twice , half or the same as the input feature , as illustrated in Figure 2 ( a ) . Considering operators with different strides within a mixed-block and the variation of sizes output from different operators in one mixed-block , the super-net is designed as a path-wise structure like Guo et al . ( 2019 ) . One path in the super-net is treated as valid if none of the blocks output feature larger than a quarter or smaller than 1/64 of the input image . Invalid paths are removed either in the training process of super-net or the sampling during the evolutionary search . Lateral connections Lateral connections are built according to current sub-architecture , as Figure 1 ( b ) shows . One additional 1×1 lateral convolution attached after every mix-block is available for latter cross-block connections . In scale-decreasing architectures , blocks can be grouped by resolution of output features . Each group is notated as one stage . Similarly , we refer stage to a group of adjacent blocks with the same output resolution , e.g . one downsampling or upsampling block and following normal blocks . The feature map of the last mix-block at one stage is merged with the lateral feature by element-wise addition as Equation 4-Equation 6 shows . xi =MBi ( xi−1 ) + lati ( 4 ) lati = { LateralConvri ( xri ) , if ( stridei+1 6= 1 ) or ( i = N − 1 ) 0 , otherwise ( 5 ) where ri = max ( { k | ( ∏ k < j≤i stridej = 1 ) and ( stridek+1 6= 1 ) } ) ( 6 ) where lati means the lateral connection of block i to combine with . If block i is the last block of a stage or the end of the encoder network as described in Equation5 , lati is generated by lateral convolution LateralConvri . Among blocks with output feature of the same resolution as block i , block ri is the nearest one at a different stage . It can be regarded as an extensive version of lateral connections in the original FPN structure .
This paper introduces a network architecture search (NAS) suitable for a feature pyramid network (FPN) that provides notable detection accuracy for objects at every scale. Based on the decomposition of FPN structure as (multi-scale) feature generation and feature utilization, the proposed NAS offers a new design strategies for both components. For feature generation, NAS super-net is trained to find the optimal selection of whether to reduce, maintain, or extend feature resolution after each module. For feature utilitization, it defines conditions for efficiently selecting the optimal FPN architecture. The proposed MSNAS yields the better accuracy than its backbone FPN and other NAS methods on the COCO object detection benchmark dataset.
SP:648c9f61876219050edc481d57891ec3465617d3
Prototypical Representation Learning for Relation Extraction
1 INTRODUCTION . Relation extraction aims to predict relations between entities in sentences , which is crucial for understanding the structure of human knowledge and automatically extending knowledge bases ( Cohen & Hirsh , 1994 ; Bordes et al. , 2013 ; Zeng et al. , 2015 ; Schlichtkrull et al. , 2018 ; Shen et al. , 2020 ) . Learning representations for relation extraction is challenging due to the rich forms of expressions in human language , which usually contains fine-grained , complicated correlations between marked entities . Although many works are proposed to learn representations for relations from well-structured knowledge ( Bordes et al. , 2013 ; Lin et al. , 2015 ; Ji et al. , 2015 ) , when we extend the learning source to be unstructured distantly-labeled text ( Mintz et al. , 2009 ) , this task becomes particularly challenging due to spurious correlations and label noise ( Riedel et al. , 2010 ) . This paper aims to learn predictive , interpretable , and robust relation representations from large-scale distantly labeled data . We propose a prototype learning approach , where we impose a prototype for each relation and learn the representations from the semantics of each statement , rather than solely from the noisy distant labels . Statements are defined as sentences expressing relations between two marked entities . As shown in Figure 1 , a prototype is an embedding in the representation space capturing the most essential semantics of different statements for a given relation . These prototypes essentially serve as the center of data representation clusters for different relations and are surrounded by statements expressing the same relation . We learn the relation and prototype representations based on objective functions with clear geometric interpretations . Specifically , our approach assumes prototypes are unit vectors uniformly dispersed in a unit ball , and statement embeddings are centered ∗Equal contribution . †Corresponding author . ‡http : //ruizhang.info -8.703243 38.913616 -11.877513 26.187891 -10.24494 31.439125 -11.185886 28.53963 -6.7643037 31.873375 -9.293796 30.790508 -7.6870537 36.014236 -11.216029 31.59263 -7.4329624 35.181496 -10.611754 35.345486 -12.039416 22.71971 -11.616351 26.774305 -8.657383 35.28101 -13.320659 29.52109 -11.843529 26.295746 -10.6841545 28.803246 -7.6381073 36.70645 -9.564307 31.78187 -7.315561 39.579956 -4.533672 34.883198 -8.275788 33.035698 -7.4689636 35.644993 -11.624744 30.369122 -9.997218 38.49715 -7.7783055 37.59266 -9.765418 38.476517 -9.501085 32.574696 -6.3372855 37.55847 -11.9366 27.271059 -12.867382 36.685673 -10.081516 36.11969 -11.364351 34.99714 -13.114578 37.7766 -12.3460045 36.313652 -10.533733 29.321291 -6.8389997 37.80524 -10.056862 37.98478 -11.23021 29.466564 -8.006758 36.853874 -9.294378 29.327047 -10.339967 35.70266 -10.410015 31.533749 -13.232315 35.18631 -13.210859 29.454363 -7.7240295 37.255066 -10.900574 32.073906 -7.5629783 36.904022 -10.104565 31.449959 -8.409077 33.879704 -4.9887133 35.23039 -9.434023 33.882618 -10.956362 38.222942 -12.509354 31.459927 -6.1397 37.212097 -8.249299 36.092 -8.1636095 38.060524 -13.816341 26.780077 -12.954381 37.67792 -8.914301 38.879467 -11.33116 32.713974 15.663114 12.8621025 17.03712 18.486742 17.551886 14.484679 18.931808 18.930895 15.572551 13.700756 10.558792 17.574535 17.613794 13.805676 17.844099 18.073603 10.654739 18.235968 16.538021 10.523316 17.641438 13.43363 14.079281 12.15079 18.864927 14.856975 15.856341 10.3096 14.077647 16.088354 8.66363 17.863062 13.279723 15.911679 19.156492 14.567751 16.535969 16.739618 17.02585 13.34684 18.596682 11.846535 12.980082 18.898485 16.939898 17.028992 11.612106 16.237764 16.605167 17.61748 17.126232 9.916799 18.854584 16.075922 10.663816 15.945908 15.273596 11.521369 13.061167 16.711267 17.905909 10.257096 12.815981 17.505522 15.421573 16.05703 17.434866 14.227275 14.178516 17.211475 16.826227 12.7907715 8.85155 18.680946 16.42301 15.614987 16.469488 15.520174 17.752037 11.194748 13.268249 11.668395 19.25654 19.09535 17.51284 8.887941 10.873803 14.245057 15.503976 14.112884 12.484748 12.027752 12.8171425 9.299756 10.16367 10.303493 19.28029 17.801203 6.9740515 14.092293 16.590027 14.853376 15.17265 18.155851 18.5615 18.52006 17.618689 14.498615 16.670238 16.880407 18.137753 16.441898 14.629623 19.16981 17.200861 18.588112 17.524498 11.210086 17.630442 18.84577 11.128795 -11.828977 -43.852882 -18.523153 -48.35973 -9.013127 -49.965767 -12.775725 -38.4372 -11.386365 -45.235485 -12.341138 -46.811172 -18.695421 -47.257236 -17.548359 -47.813652 -16.86908 -47.66306 -9.285677 -48.134 -15.553001 -47.495358 -14.435563 -47.35719 -15.938199 -44.728043 -10.96651 -50.96271 -9.333371 -47.840088 -8.612561 -50.579475 -9.66584 -45.757843 -14.620562 -36.031902 -13.302847 -47.38101 -12.612855 -44.99101 -11.566471 -48.70189 -14.438774 -45.744644 -13.297511 -51.752514 -12.276336 -48.390713 -8.143216 -49.363167 -14.794755 -45.36748 -9.096069 -49.784893 -9.096887 -48.303566 -11.601617 -40.474926 -8.760579 -48.474392 -8.8828 -51.211826 -14.739173 -13.053048 -14.749782 -44.379173 -13.720553 -47.30534 -13.980023 -38.663837 -16.943655 -45.568115 -7.284974 -47.792404 -13.98673 -38.59544 -15.000847 -42.772976 -11.206605 -39.627068 -14.621026 -37.741215 -5.989932 -49.660408 -7.066158 -50.164024 -13.359581 -41.030807 -11.044324 -48.147877 -10.257005 -41.0706 -8.1137085 -49.74866 -11.536943 -44.25597 -10.309574 -49.382477 -16.535332 -48.246834 -16.57508 -44.80348 -14.411162 -48.468327 -14.510945 -36.572926 -14.163412 -45.338158 -19.041832 -47.55801 -14.49797 -46.043823 -16.699863 -49.536724 -15.524808 -47.48149 -8.445343 -48.45605 -11.151114 -46.65739 -14.092925 -49.13657 -8.212766 -49.940895 -11.3532095 -46.101093 -11.26969 -45.414417 -7.291685 -49.634018 -15.727305 -43.962696 -14.725657 -36.18008 -8.530978 -48.039 -12.263783 -46.4457 -13.111706 -45.93163 -16.514885 -47.25092 -17.156609 -46.77544 10.73023 -60.08112 -8.636485 -48.777756 -15.849547 -46.368256 -14.301521 -36.94852 -13.472748 -47.12356 9.924656 -54.517498 -12.016547 -49.535435 -12.705193 -43.919346 -13.171877 -39.083767 -13.118616 -42.864147 -14.06309 -49.1256 -6.9750905 -51.342743 -10.250488 -47.86121 -6.3860655 -50.226997 -13.797769 -46.049805 -9.539331 -43.63843 -7.4702673 -50.618774 -14.247917 -38.567375 -15.689215 -35.869644 -11.770379 -46.01179 -7.974457 -48.025314 -15.115464 -41.50516 -17.751368 -47.27474 -11.07022 -47.56136 -12.364049 -45.718647 -7.192023 -51.772503 -16.014822 -36.732063 -11.9974165 -42.06392 -9.965427 -51.854122 -13.210664 -38.62058 -8.270923 -49.581097 -11.441111 -49.41309 -8.452865 -13.024228 -14.365504 -41.821922 -15.149126 -40.793488 -13.114061 -43.343094 -15.477967 -42.245445 -16.184212 -41.677425 -15.117426 -47.537777 -11.991396 -41.70241 -12.122491 -44.353127 -14.115153 -36.14243 -13.586221 -45.992226 -13.601769 -44.940388 -10.696865 -45.62354 -9.2235775 -48.957237 -8.406905 -50.76499 -18.666452 -47.53441 -7.9554815 -46.99664 -10.015536 -52.052444 -14.992561 -37.97665 -14.920621 -48.478596 at the end of their corresponding prototype vectors on the surface of the ball . We propose statementstatement and prototype-statement objectives to ensure the intra-class compactness and inter-class separability . Unlike conventional cross-entropy loss that only uses instance-level supervision ( which could be noisy ) , our objectives exploit the interactions among all statements , leading to a predictively powerful encoder with more interpretable and robust representations . We further explore these properties of learned representations with extensive experiments . We apply our approach using a pretraining fine-tuning paradigm . We first pretrain a relation encoder with prototypes from a large-scale distantly labeled dataset , then fine-tune it on the target dataset with different relational learning settings . We further propose a probing dataset , FuzzyRED dataset ( Section 4.3 ) , to verify if our method can capture the underlying semantics of statements . Experiments demonstrate the predictive performance , robustness , and interpretability of our method . For predictive performance , we show that our model outperforms existing state-of-the art methods on supervised , few-shot , and zero-shot settings ( Section 4.4 and 4.2 ) . For robustness , we show how the model generalize to zero-shot setting ( Section 4.2 ) and how the prototypes regularize the decision boundary ( Section 4.5 ) . For interpretability , we visualize the learned embeddings and their corresponding prototypes ( Section 4.4 ) and show the cluster clearly follow the geometric structure that the objective functions impose . The source code of the paper will be released at https : //github.com/ Alibaba-NLP/ProtoRE . 2 RELATED WORK . Relation learning could be mainly divided into three categories . The logic-based methods reason relations via symbolic logic rules , with adopting probabilistic graphical models or inductive logic systems to learn and infer logic rules orienting to relations ( Cohen & Hirsh , 1994 ; Wang et al. , 2015 ; Yang et al. , 2017 ; Chen et al. , 2018 ; Kazemi & Poole , 2018 ; Qu & Tang , 2019 ) . The graph-based methods encode entities and relations into low-dimensional continues spaces to capture structure features of KBs . ( Nickel et al. , 2011 ; Bordes et al. , 2013 ; Yang et al. , 2015 ; Wang et al. , 2014 ; Nickel et al. , 2016 ; Ji et al. , 20 ; Lin et al. , 15 ; Trouillon et al. , 2016 ; Sun et al. , 2019 ; Balažević et al. , 2019 ) . The text-based methods have been widely explored recently , focusing on extracting semantic features from text to learn relations . The conventional methods to learn relations from the text are mainly supervised models , like statistical supervised models ( Zelenko et al. , 2003 ; GuoDong et al. , 2005 ; Mooney & Bunescu , 2006 ) . As deep neural networks have gained much attention then , a series of neural supervised models have been proposed ( Liu et al. , 2013 ; Zeng et al. , 2014 ; Xu et al. , 2015 ; Santos et al. , 2015 ; Zhang & Wang , 2015 ; Verga et al. , 2016 ; Verga & McCallum , 2016 ; Li et al. , 2019 ; Distiawan et al. , 2019 ; Ding et al. , 2019 ) . To address the issue of the insufficiency of annotated data , distant supervision has been applied to automatically generate a dataset with heuristic rules ( Mintz et al. , 2009 ) . Accompanying with auto-labeled data , massive noise will be introduced into models . Accordingly , various denoising methods have been explored to reduce noise effects for distant supervision ( Zeng et al. , 2015 ; Lin et al. , 2016 ; Jiang et al. , 2016 ; Han et al. , 2018a ; Wu et al. , 2017 ; Qin et al. , 2018a ; b ; Feng et al. , 2 2018 ) . Further efforts pay attention to learning relations from the text in various specific scenarios , such as zero-few-shot scenarios ( Levy et al. , 2017 ; Han et al. , 2018b ; Gao et al. , 2019 ; Soares et al. , 2019 ; Ye & Ling , 2019 ) and open-domain scenarios ( Banko et al. , 2007 ; Fader et al. , 2011 ; Mausam et al. , 2012 ; Del Corro & Gemulla , 2013 ; Angeli et al. , 2015 ; Stanovsky & Dagan , 2016 ; Mausam , 2016 ; Cui et al. , 2018 ; Shinyama & Sekine , 2006 ; Elsahar et al. , 2017 ; Wu et al. , 2019 ) . However , up to now , there are few strategies of relation learning that could be adapted to any relation learning tasks . Soares et al . ( 2019 ) introduces a preliminary method that learns relation representations from unstructured corpus . And the assumption that two same entities must express the same relation is imprecise , because it does not consider the semantics of contextual information . This paper abstracts the task from the text as a metric and prototype learning problem and proposes a interpretable method for relation representation learning . Apart from the differences in methods and task scenarios , row-less universal schema ( Verga & McCallum , 2016 ) has a similar spirit with our method , where relation type embeddings guide clustering of statements for entity pair representations and embeddings of entity pairs are regarded as an aggregation of relations . Although the intuition that assigns a representative prototype for each class is similar to some previous studies like Prototypical Networks ( Snell et al. , 2017 ) ( ProtoNet ) , there exist some essential distinctions between our approach and the ProtoNet . The ProtoNet computes the prototype of each class as the average of the embeddings of all the instance embeddings , that could be regarded as a non-linear version of the nearest class mean approach ( Mensink et al. , 2013 ) . The idea of mean-ofclass prototypes could also be traced to earlier studies in machine learning ( Graf et al. , 2009 ) and cognitive modeling and psychology ( Reed , 1972 ; Rosch et al. , 1976 ) . In our method , prototypes and relation encoder are collaboratively and dynamically trained by three objectives , which divides the high-dimensional feature space into disjoint manifolds . The ProtoNet performs instance-level classification to update the parameters , which is not robust for noisy labels . Our method carries out a novel prototype-level classification to effectively regularize the semantic information . The prototype-level classification reduces the distortion caused by noisy labels of the decision boundary fitted by NNs . Moreover , the ProtoNet is designed for few-zero-shot learning and our methods are more like a semi-supervised pre-training approach that could be applied to supervised , few-shot , and transfer learning scenarios . Furthermore , the ProtoNet does not contain the metric learning among instances , and our method simultaneously optimizes the prototype-statement and statement-statement metrics . We also make a geometry explanation of our method ( Section 3.1 ) .
This paper presents a pre-training method for encoders (i.e., BERT) of relation extraction, leveraging distant supervision data. The main idea is to introduce a prototype embedding for each relation in the distantly generated data. The loss function to pre-train the encoders involve several terms, aiming to exploit the intra-class compactness (e.g., the contrastive loss for statement pairs) and the inter-class separability (i.e., constraining the distances between the prototype for one relation and the embeddings of the statements for the same and different relations). The paper incorporates a prototype-level classification loss. Compared to few-shot learning models (e.g., prototypical networks), the paper claims that prototype-based losses can help the model to better address the noisy label issue of distantly generated data due to the exploitation of prototype and instance interactions. The pre-trained encoder is then applied on datasets for few-shot, supervised, and fuzzy relation extraction. The proposed method achieves competitive performance with other methods. Some analysis are also conducted to demonstrate the effectiveness of the proposed model.
SP:e23a409a3fc7b9ac30367891a19f33934915f9a6
Prototypical Representation Learning for Relation Extraction
1 INTRODUCTION . Relation extraction aims to predict relations between entities in sentences , which is crucial for understanding the structure of human knowledge and automatically extending knowledge bases ( Cohen & Hirsh , 1994 ; Bordes et al. , 2013 ; Zeng et al. , 2015 ; Schlichtkrull et al. , 2018 ; Shen et al. , 2020 ) . Learning representations for relation extraction is challenging due to the rich forms of expressions in human language , which usually contains fine-grained , complicated correlations between marked entities . Although many works are proposed to learn representations for relations from well-structured knowledge ( Bordes et al. , 2013 ; Lin et al. , 2015 ; Ji et al. , 2015 ) , when we extend the learning source to be unstructured distantly-labeled text ( Mintz et al. , 2009 ) , this task becomes particularly challenging due to spurious correlations and label noise ( Riedel et al. , 2010 ) . This paper aims to learn predictive , interpretable , and robust relation representations from large-scale distantly labeled data . We propose a prototype learning approach , where we impose a prototype for each relation and learn the representations from the semantics of each statement , rather than solely from the noisy distant labels . Statements are defined as sentences expressing relations between two marked entities . As shown in Figure 1 , a prototype is an embedding in the representation space capturing the most essential semantics of different statements for a given relation . These prototypes essentially serve as the center of data representation clusters for different relations and are surrounded by statements expressing the same relation . We learn the relation and prototype representations based on objective functions with clear geometric interpretations . Specifically , our approach assumes prototypes are unit vectors uniformly dispersed in a unit ball , and statement embeddings are centered ∗Equal contribution . †Corresponding author . ‡http : //ruizhang.info -8.703243 38.913616 -11.877513 26.187891 -10.24494 31.439125 -11.185886 28.53963 -6.7643037 31.873375 -9.293796 30.790508 -7.6870537 36.014236 -11.216029 31.59263 -7.4329624 35.181496 -10.611754 35.345486 -12.039416 22.71971 -11.616351 26.774305 -8.657383 35.28101 -13.320659 29.52109 -11.843529 26.295746 -10.6841545 28.803246 -7.6381073 36.70645 -9.564307 31.78187 -7.315561 39.579956 -4.533672 34.883198 -8.275788 33.035698 -7.4689636 35.644993 -11.624744 30.369122 -9.997218 38.49715 -7.7783055 37.59266 -9.765418 38.476517 -9.501085 32.574696 -6.3372855 37.55847 -11.9366 27.271059 -12.867382 36.685673 -10.081516 36.11969 -11.364351 34.99714 -13.114578 37.7766 -12.3460045 36.313652 -10.533733 29.321291 -6.8389997 37.80524 -10.056862 37.98478 -11.23021 29.466564 -8.006758 36.853874 -9.294378 29.327047 -10.339967 35.70266 -10.410015 31.533749 -13.232315 35.18631 -13.210859 29.454363 -7.7240295 37.255066 -10.900574 32.073906 -7.5629783 36.904022 -10.104565 31.449959 -8.409077 33.879704 -4.9887133 35.23039 -9.434023 33.882618 -10.956362 38.222942 -12.509354 31.459927 -6.1397 37.212097 -8.249299 36.092 -8.1636095 38.060524 -13.816341 26.780077 -12.954381 37.67792 -8.914301 38.879467 -11.33116 32.713974 15.663114 12.8621025 17.03712 18.486742 17.551886 14.484679 18.931808 18.930895 15.572551 13.700756 10.558792 17.574535 17.613794 13.805676 17.844099 18.073603 10.654739 18.235968 16.538021 10.523316 17.641438 13.43363 14.079281 12.15079 18.864927 14.856975 15.856341 10.3096 14.077647 16.088354 8.66363 17.863062 13.279723 15.911679 19.156492 14.567751 16.535969 16.739618 17.02585 13.34684 18.596682 11.846535 12.980082 18.898485 16.939898 17.028992 11.612106 16.237764 16.605167 17.61748 17.126232 9.916799 18.854584 16.075922 10.663816 15.945908 15.273596 11.521369 13.061167 16.711267 17.905909 10.257096 12.815981 17.505522 15.421573 16.05703 17.434866 14.227275 14.178516 17.211475 16.826227 12.7907715 8.85155 18.680946 16.42301 15.614987 16.469488 15.520174 17.752037 11.194748 13.268249 11.668395 19.25654 19.09535 17.51284 8.887941 10.873803 14.245057 15.503976 14.112884 12.484748 12.027752 12.8171425 9.299756 10.16367 10.303493 19.28029 17.801203 6.9740515 14.092293 16.590027 14.853376 15.17265 18.155851 18.5615 18.52006 17.618689 14.498615 16.670238 16.880407 18.137753 16.441898 14.629623 19.16981 17.200861 18.588112 17.524498 11.210086 17.630442 18.84577 11.128795 -11.828977 -43.852882 -18.523153 -48.35973 -9.013127 -49.965767 -12.775725 -38.4372 -11.386365 -45.235485 -12.341138 -46.811172 -18.695421 -47.257236 -17.548359 -47.813652 -16.86908 -47.66306 -9.285677 -48.134 -15.553001 -47.495358 -14.435563 -47.35719 -15.938199 -44.728043 -10.96651 -50.96271 -9.333371 -47.840088 -8.612561 -50.579475 -9.66584 -45.757843 -14.620562 -36.031902 -13.302847 -47.38101 -12.612855 -44.99101 -11.566471 -48.70189 -14.438774 -45.744644 -13.297511 -51.752514 -12.276336 -48.390713 -8.143216 -49.363167 -14.794755 -45.36748 -9.096069 -49.784893 -9.096887 -48.303566 -11.601617 -40.474926 -8.760579 -48.474392 -8.8828 -51.211826 -14.739173 -13.053048 -14.749782 -44.379173 -13.720553 -47.30534 -13.980023 -38.663837 -16.943655 -45.568115 -7.284974 -47.792404 -13.98673 -38.59544 -15.000847 -42.772976 -11.206605 -39.627068 -14.621026 -37.741215 -5.989932 -49.660408 -7.066158 -50.164024 -13.359581 -41.030807 -11.044324 -48.147877 -10.257005 -41.0706 -8.1137085 -49.74866 -11.536943 -44.25597 -10.309574 -49.382477 -16.535332 -48.246834 -16.57508 -44.80348 -14.411162 -48.468327 -14.510945 -36.572926 -14.163412 -45.338158 -19.041832 -47.55801 -14.49797 -46.043823 -16.699863 -49.536724 -15.524808 -47.48149 -8.445343 -48.45605 -11.151114 -46.65739 -14.092925 -49.13657 -8.212766 -49.940895 -11.3532095 -46.101093 -11.26969 -45.414417 -7.291685 -49.634018 -15.727305 -43.962696 -14.725657 -36.18008 -8.530978 -48.039 -12.263783 -46.4457 -13.111706 -45.93163 -16.514885 -47.25092 -17.156609 -46.77544 10.73023 -60.08112 -8.636485 -48.777756 -15.849547 -46.368256 -14.301521 -36.94852 -13.472748 -47.12356 9.924656 -54.517498 -12.016547 -49.535435 -12.705193 -43.919346 -13.171877 -39.083767 -13.118616 -42.864147 -14.06309 -49.1256 -6.9750905 -51.342743 -10.250488 -47.86121 -6.3860655 -50.226997 -13.797769 -46.049805 -9.539331 -43.63843 -7.4702673 -50.618774 -14.247917 -38.567375 -15.689215 -35.869644 -11.770379 -46.01179 -7.974457 -48.025314 -15.115464 -41.50516 -17.751368 -47.27474 -11.07022 -47.56136 -12.364049 -45.718647 -7.192023 -51.772503 -16.014822 -36.732063 -11.9974165 -42.06392 -9.965427 -51.854122 -13.210664 -38.62058 -8.270923 -49.581097 -11.441111 -49.41309 -8.452865 -13.024228 -14.365504 -41.821922 -15.149126 -40.793488 -13.114061 -43.343094 -15.477967 -42.245445 -16.184212 -41.677425 -15.117426 -47.537777 -11.991396 -41.70241 -12.122491 -44.353127 -14.115153 -36.14243 -13.586221 -45.992226 -13.601769 -44.940388 -10.696865 -45.62354 -9.2235775 -48.957237 -8.406905 -50.76499 -18.666452 -47.53441 -7.9554815 -46.99664 -10.015536 -52.052444 -14.992561 -37.97665 -14.920621 -48.478596 at the end of their corresponding prototype vectors on the surface of the ball . We propose statementstatement and prototype-statement objectives to ensure the intra-class compactness and inter-class separability . Unlike conventional cross-entropy loss that only uses instance-level supervision ( which could be noisy ) , our objectives exploit the interactions among all statements , leading to a predictively powerful encoder with more interpretable and robust representations . We further explore these properties of learned representations with extensive experiments . We apply our approach using a pretraining fine-tuning paradigm . We first pretrain a relation encoder with prototypes from a large-scale distantly labeled dataset , then fine-tune it on the target dataset with different relational learning settings . We further propose a probing dataset , FuzzyRED dataset ( Section 4.3 ) , to verify if our method can capture the underlying semantics of statements . Experiments demonstrate the predictive performance , robustness , and interpretability of our method . For predictive performance , we show that our model outperforms existing state-of-the art methods on supervised , few-shot , and zero-shot settings ( Section 4.4 and 4.2 ) . For robustness , we show how the model generalize to zero-shot setting ( Section 4.2 ) and how the prototypes regularize the decision boundary ( Section 4.5 ) . For interpretability , we visualize the learned embeddings and their corresponding prototypes ( Section 4.4 ) and show the cluster clearly follow the geometric structure that the objective functions impose . The source code of the paper will be released at https : //github.com/ Alibaba-NLP/ProtoRE . 2 RELATED WORK . Relation learning could be mainly divided into three categories . The logic-based methods reason relations via symbolic logic rules , with adopting probabilistic graphical models or inductive logic systems to learn and infer logic rules orienting to relations ( Cohen & Hirsh , 1994 ; Wang et al. , 2015 ; Yang et al. , 2017 ; Chen et al. , 2018 ; Kazemi & Poole , 2018 ; Qu & Tang , 2019 ) . The graph-based methods encode entities and relations into low-dimensional continues spaces to capture structure features of KBs . ( Nickel et al. , 2011 ; Bordes et al. , 2013 ; Yang et al. , 2015 ; Wang et al. , 2014 ; Nickel et al. , 2016 ; Ji et al. , 20 ; Lin et al. , 15 ; Trouillon et al. , 2016 ; Sun et al. , 2019 ; Balažević et al. , 2019 ) . The text-based methods have been widely explored recently , focusing on extracting semantic features from text to learn relations . The conventional methods to learn relations from the text are mainly supervised models , like statistical supervised models ( Zelenko et al. , 2003 ; GuoDong et al. , 2005 ; Mooney & Bunescu , 2006 ) . As deep neural networks have gained much attention then , a series of neural supervised models have been proposed ( Liu et al. , 2013 ; Zeng et al. , 2014 ; Xu et al. , 2015 ; Santos et al. , 2015 ; Zhang & Wang , 2015 ; Verga et al. , 2016 ; Verga & McCallum , 2016 ; Li et al. , 2019 ; Distiawan et al. , 2019 ; Ding et al. , 2019 ) . To address the issue of the insufficiency of annotated data , distant supervision has been applied to automatically generate a dataset with heuristic rules ( Mintz et al. , 2009 ) . Accompanying with auto-labeled data , massive noise will be introduced into models . Accordingly , various denoising methods have been explored to reduce noise effects for distant supervision ( Zeng et al. , 2015 ; Lin et al. , 2016 ; Jiang et al. , 2016 ; Han et al. , 2018a ; Wu et al. , 2017 ; Qin et al. , 2018a ; b ; Feng et al. , 2 2018 ) . Further efforts pay attention to learning relations from the text in various specific scenarios , such as zero-few-shot scenarios ( Levy et al. , 2017 ; Han et al. , 2018b ; Gao et al. , 2019 ; Soares et al. , 2019 ; Ye & Ling , 2019 ) and open-domain scenarios ( Banko et al. , 2007 ; Fader et al. , 2011 ; Mausam et al. , 2012 ; Del Corro & Gemulla , 2013 ; Angeli et al. , 2015 ; Stanovsky & Dagan , 2016 ; Mausam , 2016 ; Cui et al. , 2018 ; Shinyama & Sekine , 2006 ; Elsahar et al. , 2017 ; Wu et al. , 2019 ) . However , up to now , there are few strategies of relation learning that could be adapted to any relation learning tasks . Soares et al . ( 2019 ) introduces a preliminary method that learns relation representations from unstructured corpus . And the assumption that two same entities must express the same relation is imprecise , because it does not consider the semantics of contextual information . This paper abstracts the task from the text as a metric and prototype learning problem and proposes a interpretable method for relation representation learning . Apart from the differences in methods and task scenarios , row-less universal schema ( Verga & McCallum , 2016 ) has a similar spirit with our method , where relation type embeddings guide clustering of statements for entity pair representations and embeddings of entity pairs are regarded as an aggregation of relations . Although the intuition that assigns a representative prototype for each class is similar to some previous studies like Prototypical Networks ( Snell et al. , 2017 ) ( ProtoNet ) , there exist some essential distinctions between our approach and the ProtoNet . The ProtoNet computes the prototype of each class as the average of the embeddings of all the instance embeddings , that could be regarded as a non-linear version of the nearest class mean approach ( Mensink et al. , 2013 ) . The idea of mean-ofclass prototypes could also be traced to earlier studies in machine learning ( Graf et al. , 2009 ) and cognitive modeling and psychology ( Reed , 1972 ; Rosch et al. , 1976 ) . In our method , prototypes and relation encoder are collaboratively and dynamically trained by three objectives , which divides the high-dimensional feature space into disjoint manifolds . The ProtoNet performs instance-level classification to update the parameters , which is not robust for noisy labels . Our method carries out a novel prototype-level classification to effectively regularize the semantic information . The prototype-level classification reduces the distortion caused by noisy labels of the decision boundary fitted by NNs . Moreover , the ProtoNet is designed for few-zero-shot learning and our methods are more like a semi-supervised pre-training approach that could be applied to supervised , few-shot , and transfer learning scenarios . Furthermore , the ProtoNet does not contain the metric learning among instances , and our method simultaneously optimizes the prototype-statement and statement-statement metrics . We also make a geometry explanation of our method ( Section 3.1 ) .
The authors propose a novel method for learning prototype representation for relations which abstracts the essential semantics of relations between entities in sentences. The learned prototypes are learned based on an objective with clear geometric interpretation and have been shown to be interpretable and robust to noisy from distantly-supervised data. The method has been shown to be effective for supervised, few-shot, and distantly supervised relation extraction. The prototype embeddings are are unit vectors uniformly dispersed in a unit ball and statement embeddings are centered at the end of their corresponding prototypes. The training is done such that intra-class compactness and inter-class separability is increased. The results show that the proposed approach gives state-of-the-art results for few-shot, supervised relation extraction. The authors demonstrate the interpretability and robustness of the method.
SP:e23a409a3fc7b9ac30367891a19f33934915f9a6
GN-Transformer: Fusing AST and Source Code information in Graph Networks
1 INTRODUCTION . Code summarization is the task of generating a readable summary that describes the functionality of a snippet . Such task requires a high-level comprehension of a source code snippet thus it is an effective task to evaluate whether a Deep Learning Model is able to capture complex relations and structures inside code . Programming languages are context-free formal language , an unambiguous representation , Abstract Syntax Tree ( AST ) , could be derived from a source code snippet . A parse tree based representation of code is precise and without noise . An AST accurately describes the structure of a snippet and relationships between tokens which provides valuable supplementary information for code understanding . Using graph representations of source code has been the focus of multiple methods that perform code summarization . For example , Alon et al . ( 2019a ) encoded AST paths between tokens and aggregated them by an attention mechanism . Huo et al . ( 2020 ) used CNN and DeepWalk on Control Flow Graph ( CFG ) to learn statements representations . LeClair et al . ( 2020 ) applied Graph Convolutional Networks ( GCNs ) to learn AST representation . These methods proposed different ways to extract AST features , however the cross-modal interaction ( Veličković , 2019 ) is very limited since the AST and code features are independently extracted by separate models then simply concatenated or summed . In this paper we propose a novel architecture GN-Transformer shown in Figure 2 to fuse Graph information with an equivalent sequence representation . In summary : • We extend Graph Networks ( GN ) ( Battaglia et al. , 2018 ) to a novel GN-Transformer architecture that is a sequence of GN encoder blocks followed by a vanilla Transformer decoder . • We propose a novel method for early fusion of the AST representation and that of a code snippet sequence called Syntax-Code Graph ( SCG ) • We evaluate our approach on the task of code summarization and outperform the previous state of the art in two datasets and across three metrics . We evaluated our model on Java and Python datasets used by Ahmad et al . ( 2020 ) . We compared our results to those of Ahmad et al . ( 2020 ) . Two qualitative results are presented in Figure 1 . We make available our code , trained models and pre-processed datasets in our supplementary package , and we will open-source it after the review process concludes . 2 FUSING GRAPH AND SEQUENCE INFORMATION . Previous methods consider sequences and graphs as two modalities that are processed independently . For a sequence , recurrent architectures such as RNNs , LSTMs , GRUs are commonly used . CNNs have also been applied on sliding windows of sequences ( Kim , 2014 ) . Transformers ( Vaswani et al. , 2017 ) became a popular choice for sequences in recent years . For graph data , spectrum-based methods like GCNs ( Bruna et al. , 2014 ) capture graph structure through a spectrum . Non-spectrum methods like GraphSAGE ( Hamilton et al. , 2017 ) aggregates information from neighboring nodes using different aggregators , GAT ( Veličković et al. , 2018 ) introduced attention mechanism to aggregate neighboring information . Early fusion of multiple modalities is a challenging task . As a result , late fusion methods are used when considering multi-modal information in code summarization tasks . The cross-modal interactions are less efficient in late fusion as compared to early fusion Veličković ( 2019 ) . In Section 2.1 we discuss early fusion approaches of code sequence with an AST . In Section 2.2 we discuss representing sequence in a graph . 2.1 EARLY FUSION OF SEQUENCE AND GRAPH . For early fusion of a sequence and a graph , it is common to represent them under a single unified representation and input to a deep learning model . Random walks ( Perozzi et al. , 2014 ) and structure-based traversal ( SBT ) ( Hu et al. , 2018a ) demonstrated the advantages of flattening a graph structure into a sequence . SBT converts AST into a sequence that can be used by seq2seq architectures . However , structural information contained in the AST is lost when flattened into an unstructured sequence . The main motivation of previous methods to flatten a graph structure into a sequence instead of the opposite is due to the power of sequence models when compared to their graph counter-parts . Recent advances in general frameworks such as Graph Networks ( Battaglia et al. , 2018 ) , MessagePassing Neural Networks ( MPNN ) ( Gilmer et al. , 2017 ) proposed a unified graphical representation of data . Battaglia et al . ( 2018 ) proposed an extension and generalization of previous approaches that can learn a graphical representation of data under a configurable computation unit , GN block . We discuss our GN block based encoder in Section 4.2 . There are several benefits in graph representation . Firstly it can contain different information sources with arbitrary relational inductive bias ( Battaglia et al. , 2018 ) . Secondly , a graph representation can have explicit relational inductive biases among graph entities . Thirdly , flexible augmentation of graph structure of input through expert knowledge . Additionally , better combinatorial generalization ( Battaglia et al. , 2018 ) due to the reuse of multiple information sources simultaneously in a unified representation . Finally , measures for analyzing performance through graph structures could be naturally incorporated , such as average path length L and clustering coefficient C. We discuss it in better detail in Section 3.2 . 2.2 GRAPH REPRESENTATIONS FOR SEQUENCE . In Graph Networks , defining the graph structure of input data is the main way to introduce relational inductive biases ( Battaglia et al. , 2018 ) . Relational inductive biases impose constraints on the relationship among entities . In Graph Networks , the assumption that two entities have a relation or interaction is expressed by an edge between the corresponding entity nodes . The absence of an edge expresses the assumption of isolation which means no relation or direct influence of two nodes . Sequences are unstructured data in which relationships are implicit . Implicit relationships can be represented with each token as a graph node that is fully connected with all other nodes . Such representation allows each node to interact with every other node with no explicit assumptions on isolation . Thus it allows the model to infer the relationships between them implicitly . Transformers could be regarded as inferring on such a fully connected graph , see Figure 3 ( a ) . Each token in an input sequence corresponds to a node . The relationship between tokens is thus represented by attention weights , high attention values correspond to strong interaction while low attention means isolation . It is less efficient for a model to learn to infer relationships without any explicit assumptions of interactions and isolation . AST provides precise information about interaction and isolation among tokens in source code since it ’ s a representation without noise on how the tokens interact during the execution of a code snippet . Thus a natural way of utilizing information from an AST is fusing the graph structure with an input sequence . We can find an explicit mapping between tokens in a sequence and nodes in the AST through the scope information provided by a parser for a given programming language . We are then able to find relations thus build edges between a sequence and a graph . We ’ ll further discuss the graph structure of input data and how we fuse AST with it in Section 3 . The idea of fusing a sequence and a graph can be extended to broader cases apart from AST and code snippet when the mapping is not explicit . There are techniques that are applied in knowledge graphs to find a mapping between entities in knowledge graphs and words in sequence ( Peters et al. , 2019 ) . For our problem statement , we make the reasonable assumption that an explicit mapping between the sequence and a graph can be provided . 3 GRAPH STRUCTURE OF AST AND CODE . First , we propose a simple joint graph representation of source code and AST called standard SyntaxCode Graph ( SCG ) in Section 3.1 . In Section 3.2 we discuss the influence of the structure of SCG and the existence of a theoretically optimal graph structure . 3.1 SYNTAX-CODE GRAPH . Standard SCG consists of AST nodes directly from AST and token nodes created for each code snippet token or simply referred to the remainder of the paper as token node . The attribute of an AST node is the type on AST such as “ NameExpr ” . The attribute of a token node is the identifier name such as “ a ” , “ int ” , “ + ” . Standard SCG preserves the AST structure and introduces additional edges that connect token nodes with their direct parent node in AST . The direct parent node for a token node is found through the scope information for AST nodes . Taking the statement ‘ a [ i ] =4+2 ’ as an example , the AST is shown in Figure 3 ( b ) . The scope of an AST node is determined by the positional mark given by a compiler . The positional mark of the AST node ’ AdditiveExpr ’ is line 1 , col 6 ∼ line 1 , col 8 which corresponds to ’ 4+2 ’ , so the scope covers token nodes ’ 4 ’ , ’ + ’ , and ’ 2 ’ . However , a token may be covered by the scopes of multiple AST nodes , we only connect the token with its direct parent in AST . The direct parent of a token is the deepest AST node among all AST nodes which scope covered the token . Figure 3 ( c ) shows standard SCG . Standard SCG directly builds on top of the AST structure without introducing any additional relational assumptions . Thus it objectively reflects the program structure depicted by a compiler . 3.2 OPTIMAL SYNTAX-CODE GRAPH STRUCTURE . The graph structure of SCG plays a critical role in our method . You et al . ( 2020 ) represented neural network structure as relational graphs . Message passing in a relational graph is analogous to information propagation in Graph Networks . SCG can be directly defined as the relational graph of our model . Node features could be defined as node embedding in SCG . Likewise , the message function is node-wise FFN and the aggregation function is MHA . As a result , the graph structure of SCG will influence the performance of the model . The standard SCG structure discussed in Section 3.1 is efficient but may not be optimal . Qualitatively , we observed two problems of standard SCG . The first problem is the existence of long range dependencies . It is hard to pass information between nodes separated by long paths in SCG . In Graph Networks , each node is executing an information propagation and aggregation simultaneously with neighboring nodes . For example , One graph neural networks ( GNN ) layer could be regarded as executing one turn of information propagation and aggregation . In Figure 3 ( c ) , it would require three GNN layers for information to propagate from leaf node ‘ a ’ to root node ‘ AssignExpr ’ . Thus it is difficult to propagate information between nodes in a large AST . The second problem is the isolation among token nodes . Source code token nodes can only indirectly interact with each other through AST nodes . Taking ‘ 4+2 ’ in Figure 3 ( c ) as an example , there is no direct edge between token nodes ‘ 4 ’ and ‘ 2 ’ , they can only indirectly interact through the AST node ‘ AdditiveExpr ’ . However , the information that will be passed from ’ AdditiveExpr ’ to ’ 4 ’ and ’ 2 ’ is identical . Therefore , it makes it difficult for the token nodes to learn more complex relationships with other token nodes when they are under the same expression . We analyzed the test set of the Java dataset and present the results in Figure 4 ( a ) . Longer code usually contains more long range dependencies and complex expressions that correspond to the above two problems . Hand-engineering graph structure with expert knowledge may alleviate these problems thus improve performance . However , introducing redundant edges could be lead to performance degradation . We perform two experiments on opposite sides of the spectrum in our graph structure to examine the problems above . Variant 1 added shortcut edges between a code token and AST nodes with the scope covered by that token thus the distance between all AST nodes to token nodes within its scope was shortened to 1 . Variant 2 makes token nodes fully connected , thus there is no isolation at all . We reference to those variants as Variant 1 and Variant 2 in the remainder of this text . More details on the two variants are described in Appendix D. Both variants failed to improve performance due to loss of structural information and redundant connections respectively , leading us to conclude that a trade-off of both is required . We discuss it in further detail at Section 5.2 . The optimal graph structure was also analyzed through quantitative experiments . You et al . ( 2020 ) proposed to measure the effectiveness of the message passing in a relational graph by the Average path length ( L ) and the clustering coefficient ( C ) . The authors claim that the optimal structure is a balance between the value of C and L. Figure 4 ( b ) shows L and C for our variants , a Standard AST , and that of a fully-connected relational graph such as in a Transformer which could be formulated into a relational graph by the same way of ours with different relational graph structure . A vanilla Transformer encoder has a maximum C of 1 and a minimum L of 1 . Our standard SCG , at the other extreme , has a minimum C of 0 and a relatively high L due to its tree structure . The average L of standard SCG in Java and Python dataset is 6.28 and 6.35 respectively . Figure 4 ( b ) shows that we only explored a small area of the entire design space of the possible graph structure for various L and C. You et al . ( 2020 ) proposed that the optimal structure is usually located around a ” sweet spot ” in design space between extreme cases of the tree and fully-connected structures . Model performance will improve nearing this ” sweet spot ” . Thus we conclude that there is a large potential of improving model performance by improving the input structure either through hand-engineering or additional rules tailored for the specific problem domain .
This paper focuses on the problem of training a neural model to understand source code. The authors argue that both graph information (such as the parsed abstract syntax tree) and sequence information (such as the raw program tokens) are useful for understanding code, and describe a particular method of adding raw program tokens to a graph called SCS. They also describe a modification of a transformer (called a GN-Transformer) that uses this SCS graph representation, and present results on code summarization tasks.
SP:5c62d26db077ad23a6556481905a52e86f8ef93c
GN-Transformer: Fusing AST and Source Code information in Graph Networks
1 INTRODUCTION . Code summarization is the task of generating a readable summary that describes the functionality of a snippet . Such task requires a high-level comprehension of a source code snippet thus it is an effective task to evaluate whether a Deep Learning Model is able to capture complex relations and structures inside code . Programming languages are context-free formal language , an unambiguous representation , Abstract Syntax Tree ( AST ) , could be derived from a source code snippet . A parse tree based representation of code is precise and without noise . An AST accurately describes the structure of a snippet and relationships between tokens which provides valuable supplementary information for code understanding . Using graph representations of source code has been the focus of multiple methods that perform code summarization . For example , Alon et al . ( 2019a ) encoded AST paths between tokens and aggregated them by an attention mechanism . Huo et al . ( 2020 ) used CNN and DeepWalk on Control Flow Graph ( CFG ) to learn statements representations . LeClair et al . ( 2020 ) applied Graph Convolutional Networks ( GCNs ) to learn AST representation . These methods proposed different ways to extract AST features , however the cross-modal interaction ( Veličković , 2019 ) is very limited since the AST and code features are independently extracted by separate models then simply concatenated or summed . In this paper we propose a novel architecture GN-Transformer shown in Figure 2 to fuse Graph information with an equivalent sequence representation . In summary : • We extend Graph Networks ( GN ) ( Battaglia et al. , 2018 ) to a novel GN-Transformer architecture that is a sequence of GN encoder blocks followed by a vanilla Transformer decoder . • We propose a novel method for early fusion of the AST representation and that of a code snippet sequence called Syntax-Code Graph ( SCG ) • We evaluate our approach on the task of code summarization and outperform the previous state of the art in two datasets and across three metrics . We evaluated our model on Java and Python datasets used by Ahmad et al . ( 2020 ) . We compared our results to those of Ahmad et al . ( 2020 ) . Two qualitative results are presented in Figure 1 . We make available our code , trained models and pre-processed datasets in our supplementary package , and we will open-source it after the review process concludes . 2 FUSING GRAPH AND SEQUENCE INFORMATION . Previous methods consider sequences and graphs as two modalities that are processed independently . For a sequence , recurrent architectures such as RNNs , LSTMs , GRUs are commonly used . CNNs have also been applied on sliding windows of sequences ( Kim , 2014 ) . Transformers ( Vaswani et al. , 2017 ) became a popular choice for sequences in recent years . For graph data , spectrum-based methods like GCNs ( Bruna et al. , 2014 ) capture graph structure through a spectrum . Non-spectrum methods like GraphSAGE ( Hamilton et al. , 2017 ) aggregates information from neighboring nodes using different aggregators , GAT ( Veličković et al. , 2018 ) introduced attention mechanism to aggregate neighboring information . Early fusion of multiple modalities is a challenging task . As a result , late fusion methods are used when considering multi-modal information in code summarization tasks . The cross-modal interactions are less efficient in late fusion as compared to early fusion Veličković ( 2019 ) . In Section 2.1 we discuss early fusion approaches of code sequence with an AST . In Section 2.2 we discuss representing sequence in a graph . 2.1 EARLY FUSION OF SEQUENCE AND GRAPH . For early fusion of a sequence and a graph , it is common to represent them under a single unified representation and input to a deep learning model . Random walks ( Perozzi et al. , 2014 ) and structure-based traversal ( SBT ) ( Hu et al. , 2018a ) demonstrated the advantages of flattening a graph structure into a sequence . SBT converts AST into a sequence that can be used by seq2seq architectures . However , structural information contained in the AST is lost when flattened into an unstructured sequence . The main motivation of previous methods to flatten a graph structure into a sequence instead of the opposite is due to the power of sequence models when compared to their graph counter-parts . Recent advances in general frameworks such as Graph Networks ( Battaglia et al. , 2018 ) , MessagePassing Neural Networks ( MPNN ) ( Gilmer et al. , 2017 ) proposed a unified graphical representation of data . Battaglia et al . ( 2018 ) proposed an extension and generalization of previous approaches that can learn a graphical representation of data under a configurable computation unit , GN block . We discuss our GN block based encoder in Section 4.2 . There are several benefits in graph representation . Firstly it can contain different information sources with arbitrary relational inductive bias ( Battaglia et al. , 2018 ) . Secondly , a graph representation can have explicit relational inductive biases among graph entities . Thirdly , flexible augmentation of graph structure of input through expert knowledge . Additionally , better combinatorial generalization ( Battaglia et al. , 2018 ) due to the reuse of multiple information sources simultaneously in a unified representation . Finally , measures for analyzing performance through graph structures could be naturally incorporated , such as average path length L and clustering coefficient C. We discuss it in better detail in Section 3.2 . 2.2 GRAPH REPRESENTATIONS FOR SEQUENCE . In Graph Networks , defining the graph structure of input data is the main way to introduce relational inductive biases ( Battaglia et al. , 2018 ) . Relational inductive biases impose constraints on the relationship among entities . In Graph Networks , the assumption that two entities have a relation or interaction is expressed by an edge between the corresponding entity nodes . The absence of an edge expresses the assumption of isolation which means no relation or direct influence of two nodes . Sequences are unstructured data in which relationships are implicit . Implicit relationships can be represented with each token as a graph node that is fully connected with all other nodes . Such representation allows each node to interact with every other node with no explicit assumptions on isolation . Thus it allows the model to infer the relationships between them implicitly . Transformers could be regarded as inferring on such a fully connected graph , see Figure 3 ( a ) . Each token in an input sequence corresponds to a node . The relationship between tokens is thus represented by attention weights , high attention values correspond to strong interaction while low attention means isolation . It is less efficient for a model to learn to infer relationships without any explicit assumptions of interactions and isolation . AST provides precise information about interaction and isolation among tokens in source code since it ’ s a representation without noise on how the tokens interact during the execution of a code snippet . Thus a natural way of utilizing information from an AST is fusing the graph structure with an input sequence . We can find an explicit mapping between tokens in a sequence and nodes in the AST through the scope information provided by a parser for a given programming language . We are then able to find relations thus build edges between a sequence and a graph . We ’ ll further discuss the graph structure of input data and how we fuse AST with it in Section 3 . The idea of fusing a sequence and a graph can be extended to broader cases apart from AST and code snippet when the mapping is not explicit . There are techniques that are applied in knowledge graphs to find a mapping between entities in knowledge graphs and words in sequence ( Peters et al. , 2019 ) . For our problem statement , we make the reasonable assumption that an explicit mapping between the sequence and a graph can be provided . 3 GRAPH STRUCTURE OF AST AND CODE . First , we propose a simple joint graph representation of source code and AST called standard SyntaxCode Graph ( SCG ) in Section 3.1 . In Section 3.2 we discuss the influence of the structure of SCG and the existence of a theoretically optimal graph structure . 3.1 SYNTAX-CODE GRAPH . Standard SCG consists of AST nodes directly from AST and token nodes created for each code snippet token or simply referred to the remainder of the paper as token node . The attribute of an AST node is the type on AST such as “ NameExpr ” . The attribute of a token node is the identifier name such as “ a ” , “ int ” , “ + ” . Standard SCG preserves the AST structure and introduces additional edges that connect token nodes with their direct parent node in AST . The direct parent node for a token node is found through the scope information for AST nodes . Taking the statement ‘ a [ i ] =4+2 ’ as an example , the AST is shown in Figure 3 ( b ) . The scope of an AST node is determined by the positional mark given by a compiler . The positional mark of the AST node ’ AdditiveExpr ’ is line 1 , col 6 ∼ line 1 , col 8 which corresponds to ’ 4+2 ’ , so the scope covers token nodes ’ 4 ’ , ’ + ’ , and ’ 2 ’ . However , a token may be covered by the scopes of multiple AST nodes , we only connect the token with its direct parent in AST . The direct parent of a token is the deepest AST node among all AST nodes which scope covered the token . Figure 3 ( c ) shows standard SCG . Standard SCG directly builds on top of the AST structure without introducing any additional relational assumptions . Thus it objectively reflects the program structure depicted by a compiler . 3.2 OPTIMAL SYNTAX-CODE GRAPH STRUCTURE . The graph structure of SCG plays a critical role in our method . You et al . ( 2020 ) represented neural network structure as relational graphs . Message passing in a relational graph is analogous to information propagation in Graph Networks . SCG can be directly defined as the relational graph of our model . Node features could be defined as node embedding in SCG . Likewise , the message function is node-wise FFN and the aggregation function is MHA . As a result , the graph structure of SCG will influence the performance of the model . The standard SCG structure discussed in Section 3.1 is efficient but may not be optimal . Qualitatively , we observed two problems of standard SCG . The first problem is the existence of long range dependencies . It is hard to pass information between nodes separated by long paths in SCG . In Graph Networks , each node is executing an information propagation and aggregation simultaneously with neighboring nodes . For example , One graph neural networks ( GNN ) layer could be regarded as executing one turn of information propagation and aggregation . In Figure 3 ( c ) , it would require three GNN layers for information to propagate from leaf node ‘ a ’ to root node ‘ AssignExpr ’ . Thus it is difficult to propagate information between nodes in a large AST . The second problem is the isolation among token nodes . Source code token nodes can only indirectly interact with each other through AST nodes . Taking ‘ 4+2 ’ in Figure 3 ( c ) as an example , there is no direct edge between token nodes ‘ 4 ’ and ‘ 2 ’ , they can only indirectly interact through the AST node ‘ AdditiveExpr ’ . However , the information that will be passed from ’ AdditiveExpr ’ to ’ 4 ’ and ’ 2 ’ is identical . Therefore , it makes it difficult for the token nodes to learn more complex relationships with other token nodes when they are under the same expression . We analyzed the test set of the Java dataset and present the results in Figure 4 ( a ) . Longer code usually contains more long range dependencies and complex expressions that correspond to the above two problems . Hand-engineering graph structure with expert knowledge may alleviate these problems thus improve performance . However , introducing redundant edges could be lead to performance degradation . We perform two experiments on opposite sides of the spectrum in our graph structure to examine the problems above . Variant 1 added shortcut edges between a code token and AST nodes with the scope covered by that token thus the distance between all AST nodes to token nodes within its scope was shortened to 1 . Variant 2 makes token nodes fully connected , thus there is no isolation at all . We reference to those variants as Variant 1 and Variant 2 in the remainder of this text . More details on the two variants are described in Appendix D. Both variants failed to improve performance due to loss of structural information and redundant connections respectively , leading us to conclude that a trade-off of both is required . We discuss it in further detail at Section 5.2 . The optimal graph structure was also analyzed through quantitative experiments . You et al . ( 2020 ) proposed to measure the effectiveness of the message passing in a relational graph by the Average path length ( L ) and the clustering coefficient ( C ) . The authors claim that the optimal structure is a balance between the value of C and L. Figure 4 ( b ) shows L and C for our variants , a Standard AST , and that of a fully-connected relational graph such as in a Transformer which could be formulated into a relational graph by the same way of ours with different relational graph structure . A vanilla Transformer encoder has a maximum C of 1 and a minimum L of 1 . Our standard SCG , at the other extreme , has a minimum C of 0 and a relatively high L due to its tree structure . The average L of standard SCG in Java and Python dataset is 6.28 and 6.35 respectively . Figure 4 ( b ) shows that we only explored a small area of the entire design space of the possible graph structure for various L and C. You et al . ( 2020 ) proposed that the optimal structure is usually located around a ” sweet spot ” in design space between extreme cases of the tree and fully-connected structures . Model performance will improve nearing this ” sweet spot ” . Thus we conclude that there is a large potential of improving model performance by improving the input structure either through hand-engineering or additional rules tailored for the specific problem domain .
In this work, authors propose a new direction in summarizing code snippets by combining their AST and lexical code features in the form of a graph called SCG (which is shown not to be optimal). Their model, GN-Transformer, further extracts information from SCG to summarize the code snippet. This model is a combination of transformers and graph network and is benchmarked on two datasets of Java and Python source code. The results show that the model marginally outperforms the selected benchmarks.
SP:5c62d26db077ad23a6556481905a52e86f8ef93c
LINGUINE: LearnIng to pruNe on subGraph convolUtIon NEtworks
1 INTRODUCTION . Graph Representation Learning has attracted much attention from the research communities in recent years , with emerging new work every year . Graph Convolution Neural Networks ( GCNs ) were proposed as the extension of Convolutional Neural Networks ( CNNs ) ( LeCun et al. , 1995 ) on geometric data . The first spectral-based GCN was designed on Spectral Graph Theory ( Bruna et al. , 2013 ) and was extended by many following works ( Henaff et al. , 2015 ; Defferrard et al. , 2016 ) . Over recent years , the spatial-based counterpart ( Kipf & Welling , 2016a ) gained more attention and had facilitated many machine learning tasks ( Wu et al. , 2020 ; Cai et al. , 2018 ) including semisupervised node classification ( Hamilton et al. , 2017b ) , link prediction ( Kipf & Welling , 2016b ; Berg et al. , 2017 ) and knowledge graphs ( Schlichtkrull et al. , 2018 ) . In this work , we primarily focused on large-scale spatial-based GCNs ( Hamilton et al. , 2017a ; Chen et al. , 2018b ; Gao et al. , 2018 ; Huang et al. , 2018 ; Zeng et al. , 2019 ; Zou et al. , 2019 ; Chiang et al. , 2019 ) , where a given node aggregates hidden states from its neighbors in the previous layer , followed by a non-linear activation to obtain the topological representation . However , as the graph gets larger , GNN models suffer from the challenges imposed by limited physical memory and exponentially growing computation overhead . Recent work adopted sampling methods to handle the large volume of data and facilitate batch training . The majority of them could be classified as 3 types , layer-wise sampling ( Hamilton et al. , 2017a ; Gao et al. , 2018 ; Huang et al. , 2018 ; Zou et al. , 2019 ) , node-wise sampling ( Chen et al. , 2018b ) and subgraph sampling ( Chiang et al. , 2019 ; Zeng et al. , 2019 ) . In layer-wise sampling , we take samples from the neighbors of a given node in each layer . The number of nodes is growing exponentially as the GCNs gets deeper , which resulted in ’ neighbor explosion ’ . In node-wise sampling , the nodes in each layer are sampled independently to form the structure of GCNs , which did avoid ’ neighbor explosion ’ . But the GCN ’ s structure is unstable and resulted in inferior convergence . In subgraph sampling , the GCNs are trained on a subgraph sampled on the original graph . The message was passed within the subgraph during training . This approach resolved the problem of neighbor explosion and can be applied to training deep GCNs . However , the subgraph ’ s structure and connectivity had a great impact in the training phase . It might result in suboptimal performance and slow convergence if the subgraph is overly sparse ( Chen et al. , 2018b ) . Different sampling methods can make a huge difference in the final accuracy and the convergence speed as shown in ( Zeng et al. , 2019 ) . In the context of large-scale GCN training , the limitations in GPU memory makes the maximum batch size restricted . Research communities are actively seeking efficient sampling methods to deal with the challenges in scalability , accuracy , and computation complexity on large-scale GCNs . The initiative of subgraph GCN is a stochastic approach to approximate their full-graph counterparts . However , experiments showed that GCN trained with partial information can achieve even less bias . ( Zou et al. , 2019 ) This was even more so when variance reduction is applied in GCN ’ s training , which overcomes the negative effect induced by subgraph GCNs and improves its convergence speed as well as inference performance . ( Hamilton et al. , 2017a ; Chen et al. , 2018a ; Zeng et al. , 2019 ) However , the inner mechanism behind this random sample has yet to be studied . GCNs are also made to be deeper and more complicated with architecture design . The model overcomes the drawbacks of the gradient vanishing problem via applying Deep CNN ’ s residual/dense connection and dilated convolution , achieving state of art performance on open graph benchmarks . ( Li et al. , 2019 ; 2020 ; Weihua Hu , 2020 ) However , as their model is significantly larger ( amounting to more than 100 layers in some occasions ) than previous approaches , the model is suffered from high computation overhead and memory cost . With the model taking up much space , the batch sizes are also strictly limited . We aim to provide an easier solution to train complex models while maintaining a relatively large receptive field in the graph , and keeping the training quality . We propose Linguine framework . In each forward pass , we ’ smartly prune ’ inferior nodes to extract a concentrated smaller subgraph from the large subgraph randomly sampled previously . Therefore , we reduce the batch size and the memory requirement in training the model . We are also able to train the complex GCNs with larger receptive field and achieve better performance with the same budget . We parameterize the decision function in smart pruning with a light-weight meta-model , which is fed with the meta-information we obtained from training a light-weight proxy model . This keeps the extra cost of algorithm under control . Our framework is built upon existing subgraph sampling methods and utilize joint training to learn the meta-model . Our meta-model improved the quality of the subgraphs in training via actively dropping redundant nodes from its receptive field and concentrate the information . We summarize the contributions of this work as follows : 1 . We designed a new training framework Linguine which aims to train high-performance GCNs on large graphs via model-parameterized smart pruning techniques . 2 . Linguine provides a joint-training algorithm called bootstrapping , originally designed to train the meta-model in smart pruning , but also has a favorable impact in augmenting existing models and converge to better solutions with scalability and lower bias . It is also an effective algorithm inspired by the idea in the real-world learning process . 3 . Empirical study justified that Linguine framework worked well on different scaled public benchmarks and compares favorably to previous methods . 4 . We did an analysis on the mechanism behind smart-pruning via graph visualization . 2 RELATED WORK . Our framework was inspired and built upon two popular branches in Machine Learning . Graph Neural Networks Many GNNs have emerged over the recent years . Spatial-based GCNs are the most popular approaches among them and have gained broad interest from research communities ( Atwood & Towsley , 2016 ; Niepert et al. , 2016 ; Gilmer et al. , 2017 ) . They stack multiple graph convolutional layers to extract high-level representations . In each layer , every node in the graph aggregates the hidden states from its neighbors on the previous layer . The final output is the embedding of each node in the graph . Existing work on GCNs utilized sampling technique to perform efficient minibatch training . Common approaches can be categorized as Layer-wise Sampling , Node-wise Sampling and Subgraph Sampling . In Layer-wise sampling and Node-wise Sampling , the layers are sampled recursively from top to bottom to form mini-batches . The major difference between Node-wise Sampling and Layer-wise Sampling lied in the sampling mechanism . Node-wise Sampling sampled from the whole graph dataset whereas Layer-wise Sampling only focused on the neighbors from the upper layer . In Subgraph Sampling we only sample once and propagate through the subgraph to formalize batch training . Among work in Layer-wise Sampling , GraphSAGE ( Hamilton et al. , 2017a ) performed uniform Node-wise Sampling on the neighbors of nodes in the previous layer . ( Ying et al. , 2018 ) introduced the importance score to each neighbor and performed weighted aggregation to enhance the model . The potential drawback of Layer-wise Sampling is Neighbor Explosion where we created an overly-large receptive field in the bottom layer and resulted in memory overflow . In Node-wise Sampling , FastGCN ( Chen et al. , 2018b ) performs sampling independently across all layers and perform importance sampling on the node level to reduce the variance . This approach was further extended by LADIES ( Zou et al. , 2019 ) which performs importance sampling adaptively from top to bottom . Recently , Subgraph Sampling emerged as a low complexity solution for large-scale GCN training . ClusterGCN ( Chiang et al. , 2019 ) performs clustering on the graph . This work partitions the graph into densely connected clusters . Random sampling is performed on the cluster level to form minibatches in training . GraphSAINT ( Zeng et al. , 2019 ) directly sampled the mini-batches at node-level . This approach also performed normalization at the node level to reduce the sampling variance . It achieves the new state of the art performance on multiple public datasets . The main difference between Subgraph Sampling and other approaches is that GCN is trained on the subgraph instead of a massage passing flow containing different nodes on different layers . Sampling subgraph has been an important method leveraging limited memory to achieve better performance . However , the variance introduced by sampling negatively impacts the training . Recent approaches adopted Variance Reduction ( Hamilton et al. , 2017a ; Chen et al. , 2018a ; Zeng et al. , 2019 ) to stochastically approximate the activations of sampled nodes . which was shown to boost the final model performance and convergence speed ( Zeng et al. , 2019 ) . Besides , empirical study found that different sampling methods can also create a great gap in the final performance of GCNs and varied convergence speed . The advance of deepening GCNs has drawn extensive attention in the research community , leveraging the computation power of high-performance GPU devices . ( Li et al. , 2019 ) adapted residual connections and dilated convolutions into GCNs . ( Li et al. , 2020 ) proposed a general aggregation function , which further improves the capacity of deep GCNs . Meta-Learning Our work is inspired by recent meta-learning and model-teaching approaches , which is also a trendy topic in recent years . Learning to Learn , or Meta-Learning ( Schmidhuber , 1987 ; Thrun & Pratt , 2012 ) was proposed as an exploration of using automatic learning via transferring knowledge learned from meta tasks . It was designed as a two-level structure , in which the meta-level model evolves slowly and the task model progresses quickly . Recently , meta-learning has been utilized in different machine learning scenarios . There is work trying to design optimizer and neural network architectures . ( Andrychowicz et al. , 2016 ; Li & Malik , 2016 ; Zoph & Le , 2016 ) . Other approaches similar to Meta-Learning is Teaching ( Anderson et al. , 1985 ; Goldman & Kearns , 1992 ) , which can be categorized as machineteaching and hardness based methods . Machine teaching ( Zhu , 2013 ) is to construct a minimal training set for the student model to learn a target model . However , due to the strong assumption of the oracle ’ s existence in machine teaching . Hardness-based models are proposed on the assumption that a data order from easy to hard can benefit model training . There are many different works in the hardness-based method . Curriculum Learning ( CL ) ( Bengio et al. , 2009 ; Spitkovsky et al. , 2010 ; Graves et al. , 2017 ) utilizes a hardness measure based on a heuristic understanding of data . Self-paced learning ( SPL ) ( Kumar et al. , 2010 ) heuristically define the scheduling of training data in an easy-to-hard manner . Learning to Teach ( Fan et al. , 2018 ; Wu et al. , 2018 ) designed a new teacher-student model and perform transferable model teaching . Our meta-model incorporates graph topological information and node-wise performance information into meta information . We used a learned model instead of heuristic and fixed rules in the model to explore the optimal policy .
This work proposes a new framework, called LINGUINE, to produce high-quality sub-graphs that can assist in effective training of graph convolutional networks (GCNs) with a lower computational cost. The framework uses two consecutive components - (1) Bootstrapping, which learns a meta-model that can assign weights to nodes by being jointly trained with a proxy ‘light’ GCN model (2) Smart pruning, which uses the learned meta-model to perform pruning on the large graph as the GCN model trains on it using the student-teacher learning concept. The paper presents results that the bootstrapping method improves the accuracy of smaller GCN models on large graph classification tasks. The smart pruning method removes nodes that are hard to learn or have a high degree of neighboring nodes in the subgraph, thus reducing error.
SP:aaf87fbde816b1f09befbefc7f9198022292e03a
LINGUINE: LearnIng to pruNe on subGraph convolUtIon NEtworks
1 INTRODUCTION . Graph Representation Learning has attracted much attention from the research communities in recent years , with emerging new work every year . Graph Convolution Neural Networks ( GCNs ) were proposed as the extension of Convolutional Neural Networks ( CNNs ) ( LeCun et al. , 1995 ) on geometric data . The first spectral-based GCN was designed on Spectral Graph Theory ( Bruna et al. , 2013 ) and was extended by many following works ( Henaff et al. , 2015 ; Defferrard et al. , 2016 ) . Over recent years , the spatial-based counterpart ( Kipf & Welling , 2016a ) gained more attention and had facilitated many machine learning tasks ( Wu et al. , 2020 ; Cai et al. , 2018 ) including semisupervised node classification ( Hamilton et al. , 2017b ) , link prediction ( Kipf & Welling , 2016b ; Berg et al. , 2017 ) and knowledge graphs ( Schlichtkrull et al. , 2018 ) . In this work , we primarily focused on large-scale spatial-based GCNs ( Hamilton et al. , 2017a ; Chen et al. , 2018b ; Gao et al. , 2018 ; Huang et al. , 2018 ; Zeng et al. , 2019 ; Zou et al. , 2019 ; Chiang et al. , 2019 ) , where a given node aggregates hidden states from its neighbors in the previous layer , followed by a non-linear activation to obtain the topological representation . However , as the graph gets larger , GNN models suffer from the challenges imposed by limited physical memory and exponentially growing computation overhead . Recent work adopted sampling methods to handle the large volume of data and facilitate batch training . The majority of them could be classified as 3 types , layer-wise sampling ( Hamilton et al. , 2017a ; Gao et al. , 2018 ; Huang et al. , 2018 ; Zou et al. , 2019 ) , node-wise sampling ( Chen et al. , 2018b ) and subgraph sampling ( Chiang et al. , 2019 ; Zeng et al. , 2019 ) . In layer-wise sampling , we take samples from the neighbors of a given node in each layer . The number of nodes is growing exponentially as the GCNs gets deeper , which resulted in ’ neighbor explosion ’ . In node-wise sampling , the nodes in each layer are sampled independently to form the structure of GCNs , which did avoid ’ neighbor explosion ’ . But the GCN ’ s structure is unstable and resulted in inferior convergence . In subgraph sampling , the GCNs are trained on a subgraph sampled on the original graph . The message was passed within the subgraph during training . This approach resolved the problem of neighbor explosion and can be applied to training deep GCNs . However , the subgraph ’ s structure and connectivity had a great impact in the training phase . It might result in suboptimal performance and slow convergence if the subgraph is overly sparse ( Chen et al. , 2018b ) . Different sampling methods can make a huge difference in the final accuracy and the convergence speed as shown in ( Zeng et al. , 2019 ) . In the context of large-scale GCN training , the limitations in GPU memory makes the maximum batch size restricted . Research communities are actively seeking efficient sampling methods to deal with the challenges in scalability , accuracy , and computation complexity on large-scale GCNs . The initiative of subgraph GCN is a stochastic approach to approximate their full-graph counterparts . However , experiments showed that GCN trained with partial information can achieve even less bias . ( Zou et al. , 2019 ) This was even more so when variance reduction is applied in GCN ’ s training , which overcomes the negative effect induced by subgraph GCNs and improves its convergence speed as well as inference performance . ( Hamilton et al. , 2017a ; Chen et al. , 2018a ; Zeng et al. , 2019 ) However , the inner mechanism behind this random sample has yet to be studied . GCNs are also made to be deeper and more complicated with architecture design . The model overcomes the drawbacks of the gradient vanishing problem via applying Deep CNN ’ s residual/dense connection and dilated convolution , achieving state of art performance on open graph benchmarks . ( Li et al. , 2019 ; 2020 ; Weihua Hu , 2020 ) However , as their model is significantly larger ( amounting to more than 100 layers in some occasions ) than previous approaches , the model is suffered from high computation overhead and memory cost . With the model taking up much space , the batch sizes are also strictly limited . We aim to provide an easier solution to train complex models while maintaining a relatively large receptive field in the graph , and keeping the training quality . We propose Linguine framework . In each forward pass , we ’ smartly prune ’ inferior nodes to extract a concentrated smaller subgraph from the large subgraph randomly sampled previously . Therefore , we reduce the batch size and the memory requirement in training the model . We are also able to train the complex GCNs with larger receptive field and achieve better performance with the same budget . We parameterize the decision function in smart pruning with a light-weight meta-model , which is fed with the meta-information we obtained from training a light-weight proxy model . This keeps the extra cost of algorithm under control . Our framework is built upon existing subgraph sampling methods and utilize joint training to learn the meta-model . Our meta-model improved the quality of the subgraphs in training via actively dropping redundant nodes from its receptive field and concentrate the information . We summarize the contributions of this work as follows : 1 . We designed a new training framework Linguine which aims to train high-performance GCNs on large graphs via model-parameterized smart pruning techniques . 2 . Linguine provides a joint-training algorithm called bootstrapping , originally designed to train the meta-model in smart pruning , but also has a favorable impact in augmenting existing models and converge to better solutions with scalability and lower bias . It is also an effective algorithm inspired by the idea in the real-world learning process . 3 . Empirical study justified that Linguine framework worked well on different scaled public benchmarks and compares favorably to previous methods . 4 . We did an analysis on the mechanism behind smart-pruning via graph visualization . 2 RELATED WORK . Our framework was inspired and built upon two popular branches in Machine Learning . Graph Neural Networks Many GNNs have emerged over the recent years . Spatial-based GCNs are the most popular approaches among them and have gained broad interest from research communities ( Atwood & Towsley , 2016 ; Niepert et al. , 2016 ; Gilmer et al. , 2017 ) . They stack multiple graph convolutional layers to extract high-level representations . In each layer , every node in the graph aggregates the hidden states from its neighbors on the previous layer . The final output is the embedding of each node in the graph . Existing work on GCNs utilized sampling technique to perform efficient minibatch training . Common approaches can be categorized as Layer-wise Sampling , Node-wise Sampling and Subgraph Sampling . In Layer-wise sampling and Node-wise Sampling , the layers are sampled recursively from top to bottom to form mini-batches . The major difference between Node-wise Sampling and Layer-wise Sampling lied in the sampling mechanism . Node-wise Sampling sampled from the whole graph dataset whereas Layer-wise Sampling only focused on the neighbors from the upper layer . In Subgraph Sampling we only sample once and propagate through the subgraph to formalize batch training . Among work in Layer-wise Sampling , GraphSAGE ( Hamilton et al. , 2017a ) performed uniform Node-wise Sampling on the neighbors of nodes in the previous layer . ( Ying et al. , 2018 ) introduced the importance score to each neighbor and performed weighted aggregation to enhance the model . The potential drawback of Layer-wise Sampling is Neighbor Explosion where we created an overly-large receptive field in the bottom layer and resulted in memory overflow . In Node-wise Sampling , FastGCN ( Chen et al. , 2018b ) performs sampling independently across all layers and perform importance sampling on the node level to reduce the variance . This approach was further extended by LADIES ( Zou et al. , 2019 ) which performs importance sampling adaptively from top to bottom . Recently , Subgraph Sampling emerged as a low complexity solution for large-scale GCN training . ClusterGCN ( Chiang et al. , 2019 ) performs clustering on the graph . This work partitions the graph into densely connected clusters . Random sampling is performed on the cluster level to form minibatches in training . GraphSAINT ( Zeng et al. , 2019 ) directly sampled the mini-batches at node-level . This approach also performed normalization at the node level to reduce the sampling variance . It achieves the new state of the art performance on multiple public datasets . The main difference between Subgraph Sampling and other approaches is that GCN is trained on the subgraph instead of a massage passing flow containing different nodes on different layers . Sampling subgraph has been an important method leveraging limited memory to achieve better performance . However , the variance introduced by sampling negatively impacts the training . Recent approaches adopted Variance Reduction ( Hamilton et al. , 2017a ; Chen et al. , 2018a ; Zeng et al. , 2019 ) to stochastically approximate the activations of sampled nodes . which was shown to boost the final model performance and convergence speed ( Zeng et al. , 2019 ) . Besides , empirical study found that different sampling methods can also create a great gap in the final performance of GCNs and varied convergence speed . The advance of deepening GCNs has drawn extensive attention in the research community , leveraging the computation power of high-performance GPU devices . ( Li et al. , 2019 ) adapted residual connections and dilated convolutions into GCNs . ( Li et al. , 2020 ) proposed a general aggregation function , which further improves the capacity of deep GCNs . Meta-Learning Our work is inspired by recent meta-learning and model-teaching approaches , which is also a trendy topic in recent years . Learning to Learn , or Meta-Learning ( Schmidhuber , 1987 ; Thrun & Pratt , 2012 ) was proposed as an exploration of using automatic learning via transferring knowledge learned from meta tasks . It was designed as a two-level structure , in which the meta-level model evolves slowly and the task model progresses quickly . Recently , meta-learning has been utilized in different machine learning scenarios . There is work trying to design optimizer and neural network architectures . ( Andrychowicz et al. , 2016 ; Li & Malik , 2016 ; Zoph & Le , 2016 ) . Other approaches similar to Meta-Learning is Teaching ( Anderson et al. , 1985 ; Goldman & Kearns , 1992 ) , which can be categorized as machineteaching and hardness based methods . Machine teaching ( Zhu , 2013 ) is to construct a minimal training set for the student model to learn a target model . However , due to the strong assumption of the oracle ’ s existence in machine teaching . Hardness-based models are proposed on the assumption that a data order from easy to hard can benefit model training . There are many different works in the hardness-based method . Curriculum Learning ( CL ) ( Bengio et al. , 2009 ; Spitkovsky et al. , 2010 ; Graves et al. , 2017 ) utilizes a hardness measure based on a heuristic understanding of data . Self-paced learning ( SPL ) ( Kumar et al. , 2010 ) heuristically define the scheduling of training data in an easy-to-hard manner . Learning to Teach ( Fan et al. , 2018 ; Wu et al. , 2018 ) designed a new teacher-student model and perform transferable model teaching . Our meta-model incorporates graph topological information and node-wise performance information into meta information . We used a learned model instead of heuristic and fixed rules in the model to explore the optimal policy .
This paper proposes an approach to compute GNNs on pruned subgraphs. The authors use a "meta-model" to learn a good node pruning strategy during training. Then the meta-model is used to generate pruned subgraphs during inference. The proposed pruning algorithm can be applied to various graph samplers. The authors evaluate such pruning on two simple samplers, random node and random walk samplers. Some theoretical analysis is performed. However, the analysis is not quite convincing. Evaluation on several graph benchmarks show that the proposed LINGUINE framework achieves good accuracy using pruned subgraphs.
SP:aaf87fbde816b1f09befbefc7f9198022292e03a
Benchmarking Multi-Agent Deep Reinforcement Learning Algorithms
We benchmark commonly used multi-agent deep reinforcement learning ( MARL ) algorithms on a variety of cooperative multi-agent games . While there has been significant innovation in MARL algorithms , algorithms tend to be tested and tuned on a single domain and their average performance across multiple domains is less characterized . Furthermore , since the hyperparameters of the algorithms are carefully tuned to the task of interest , it is unclear whether hyperparameters can easily be found that allow the algorithm to be repurposed for other cooperative tasks with different reward structure and environment dynamics . To investigate the consistency of the performance of MARL algorithms , we build an open-source library of multi-agent algorithms including DDPG/TD3/SAC with centralized Q functions , PPO with centralized value functions , as well as QMix , and test them across a range of tasks that vary in coordination difficulty and agent number . The domains include the Multi-agent Particle World environments , StarCraftII micromanagement challenges , the Hanabi challenges , and the Hide-And-Seek environments . Finally , we investigate the ease of hyperparameters tuning for each of the algorithms by tuning hyperparameters in one environment per domain and re-using them in the other environments within the domain . The open-source code and more details can be found in our website : https : //sites.google . com/view/marlbenchmarks . 1 INTRODUCTION . Widespread availability of high-speed computing , neural network architectures , and advances in reinforcement learning ( RL ) algorithms have led to a continuing series of interesting results in building cooperative artificial agents : agents collectively playing Hanabi to an expert level ( Hu & Foerster , 2019 ) , designing cooperative StarCraftII bots ( Rashid et al. , 2018 ) that outperform hand-designed heuristics , and constructing emergent languages between agents ( Mordatch & Abbeel , 2017 ) . Each of these aforementioned results have often come with the introduction of a new algorithm , leading to a proliferation of new algorithms that is rapidly advancing the field . However , these algorithms are often designed and tuned to get optimal performance in a particular deployment environment . In particular , it is not unusual for each new algorithm to come with a new proposed benchmark on which it is evaluated . Consequently it is not obvious that these algorithms can easily be re-purposed for new tasks ; subtle interactions between the algorithm , the architecture and the environment may lead to high asymptotic performance on one task and total failure when applied to a new task . Without examining an algorithm across a range of tasks , it is difficult to assess how general purpose it is . Furthermore , the high asymptotic rewards that are often presented may hide complexities in using the algorithms in practice . The amount of time that researchers spent in finding optimal hyperparameters is often obscured , making it unclear how extensive of a hyperparameter search was needed to find the good hyperparameters . That is , researchers will often report a grid search of hyperparameters but not the prior work that was done to pick out a hyperparameter grid that actually contained good hyperparameters . Furthermore , the amount of computation provided to tune the studied algorithm may not be provided to the baseline algorithms that it will be compared against . This can lead to an inflated performance of the proposed algorithm relative to the benchmarks . All these problems can arise without any ill intent on the part of the authors , but they make the problem of assessing algorithms quite challenging . The downstream consequence of this proliferation of algorithms coupled with an absence of standard benchmarks is a lack of clarity on the part of practitioners as to which algorithm will give consistent , high performance with minimal tuning . Researchers are often operating under computational constraints that limit how extensive of a hyper-parameter sweep they can perform ; the ease with which good hyperparameters can be found is consequently a useful metric . When tackling a new multi-agent problem , researchers have no clear answer to the questions : 1 ) which MARL algorithm should I use to maximize performance and 2 ) given my computational resources , which algorithm is likeliest to work under my constraints ? We present an attempt to evaluate the performance , robustness and the relative ease of using these algorithms by benchmarking them across a wide variety of environments that vary in both agent number , exploration difficulty , and coordination complexity . By exploring a large range of possible environments , we identify algorithms that perform well on average and serve as a strong starting point for a variety of problems . We tackle the question of relative difficulty in finding hyperparameters by looking at how hyperparameters transfer across settings : tuning hyperparameters on one set of environments and applying them without re-tuning on the remaining environments . Using this procedure , we can provide effective recommendations on algorithm choice for researchers attempting to deploy deep multi-agent reinforcement learning while operating under constrained hyper-parameter budgets . We test Proximal Policy Optimization ( Schulman et al. , 2017 ) with centralized value functions ( MAPPO ) , Multi-Agent DDPG ( MADDPG ) ( Lowe et al. , 2017 ) , Multi-Agent TD3 ( Fujimoto et al. , 2018a ) ( MATD3 ) , a Multi-Agent variant of Soft Actor Critic ( Haarnoja et al. , 2018 ) ( MASAC ) , and QMix ( Rashid et al. , 2018 ) . We focus specifically on the performance of these algorithms on fully cooperative tasks , as this avoids game theoretic issues around computing the distance to Nash equilibria , and allows us to solely characterize performance in terms of asymptotic reward . The contributions of this paper are the following • Benchmarking multi-agent variants of single-agent algorithms across a wide range of possible tasks including StarCraftII micromanagement ( Rashid et al. , 2019 ) , Multi-agent Particle World ( Mordatch & Abbeel , 2017 ) , Hanabi ( Bard et al. , 2020 ) , and the Hide-AndSeek domain ( Baker et al. , 2019 ) . • Establishing that under constrained hyperparameter searching budgets , the multi-agent variant of PPO appears to be the most consistent algorithm across different domains . • The design and release of a new multi-agent library of various on/off-policy learning algorithms with recurrent policy support . 2 RELATED WORK . MARL algorithms have a long history but have , until recently , primarily been applied in tabular settings ( Littman , 1994 ; Busoniu et al. , 2008 ) . Notions of using a Q-function that operated on the actions of all agents , known as Joint-Action Learners ( Claus & Boutilier , 1998 ) have existed in the literature since its inception with algorithms like Hyper-Q ( Tesauro , 2004 ) using inferred estimates of other agent strategies in the Q-function . Recent MARL algorithms have built upon these ideas by incorporating neural networks ( Tampuu et al. , 2017 ) , policy-gradient methods ( Foerster et al. , 2017 ) , and finding ways to combine local and centralized Q-functions to enable centralized learning with decentralized execution ( Lowe et al. , 2017 ; Sunehag et al. , 2018 ) . Alongside the proliferation of algorithms has come a wide variety of new , cooperative MARL benchmarks . Unlike single-agent RL , where MuJoCo ( Todorov et al. , 2012 ) and Atari ( Mnih et al. , 2013 ) have become standard benchmarks , there is significantly less consensus on appropriate benchmarks . In this work , we consider 4 popular multi-agent environments , which we believe are the most representative in the community . Besides those we considered in this work , other interesting cooperative environments may include MAgent ( Zheng et al. , 2017 ) , a platform that can efficiently support hundreds of particle agents for cooperative tasks , multi-agent MuJoCo , in which each joint is an independent agent ( Schroeder de Witt et al. , 2020 ) , and CityFlow ( Zhang et al. , 2019 ) , which studies large-scale decentralized traffic light control . There also has been a variety of attempts to benchmark MARL algorithms that differ in scope from our paper . Gupta et al . ( 2017 ) benchmarks a similar set of algorithms to ours on a wide variety of environments . However , they do not consider algorithms that train in a centralized fashion while acting decentralized and instead perform a comparison between fully centralized training and execution and full decentralized algorithms . They establish that parameter sharing is an essential component of getting quick convergence in MARL algorithms . Schroeder de Witt et al . ( 2020 ) benchmark algorithms with centralized Q and value functions on a decentralized variant of the MuJoCo environments ; however , they primarily study variants of QMix and MADDPG and do not compare with on-policy algorithms . 3 MARL ALGORITHMS . 3.1 PRELIMINARIES . We study decentralized partially observed Markov decision processes ( DEC-POMDP ) ( Oliehoek et al. , 2016 ) with global rewards . A DEC-POMDP is defined by an eight tuple 〈S , U , P , r , Z , O , n , γ〉 . s ∈ S is a state space describing a sufficient set of state variables to make the system dynamics Markovian . For simplicity we assume the agents share action space U and each agent a ∈ { 1 , . . . , n } picks an action ua ∈ U which are concatenated to form join action u ∈ Un . We denote the joint action without the action of agent a as u−a . Joint actions u and state are fed to state transition function P ( s′|s , u ) : S × U × S → [ 0 , 1 ] . These are cooperative tasks so all agents share a bounded reward function r ( s , u ) : S × Un → R and have shared discount factor γ ∈ [ 0 , 1 ] Each agent i has an observation function Oa ( s ) : S → Z which defines how the global state is mapped onto a local observation z ∈ Z . Each agent maintains an action-observation history τa ∈ T ∈ ( Z ×U ) ∗ which it conditions its policy πa ( ua|τa ) : T×U → [ 0 , 1 ] on . Finally , given the joint policy π ( u ) = ∏ i π a ( ua|τa ) we can define a joint value function V π ( st ) = Est+1 : ∞ [ ∑∞ i=0 γ irt+i|st ] and joint Q function Qπ ( st , ut ) = Est+1 : ∞ [ ∑∞ i=0 γ irt+i|st , ut ] . We assume that the learning algorithm has access to both true states S , as well as the trajectories of all agents τa . The agents however , only have access to τa for computing their policy . The goal of the agents is to jointly optimize the quantity Jπ = E [ ∑∞ i=0 γ ir ( st , u ) ] . 3.2 BASELINE ALGORITHMS . We introduce all the baseline algorithms we consider , including MADDPG , MATD3 , MASAC , QMix and MAPPO . For all problems considered , the action space is discrete . More algorithmic details and the complete pseudo-code can be found in the appendix . MADDPG : The MADDPG algorithm is perhaps the most popular general-purpose off-policy MARL algorithm . The algorithm was proposed by Lowe et al . ( 2017 ) , based on the DDPG algorithm ( Lillicrap et al. , 2015 ) , and uses a centralized Q-function taking observations and actions from all the agents to alleviate the non-stationarity issue and stabilize multi-agent training . Note that although DDPG was originally designed for continuous actions , MADDPG adopts the gumbel-softmax ( Jang et al. , 2016 ) trick to handle discrete actions . MATD3 : The TD3 algorithm ( Fujimoto et al. , 2018b ) is a popular enhanced version of the standard DDPG algorithm ( Lillicrap et al. , 2016 ) . We similarly apply the same centralized critic technique introduced in MADDPG to TD3 to derive a multi-agent variant of TD3 , i.e. , MATD3 . The only difference between MATD3 and MADDPG is the use of twin delayed critics and the addition of small amounts of noise to the actions sampled from the buffer . MASAC : The Soft Actor-Critic ( SAC ) algorithm ( Haarnoja et al. , 2018 ) is an extremely popular off-policy algorithm and has been considered as a state-of-the-art baseline for a diverse range of RL problems with continuous actions . Similar to MADDPG , we introduce a centralized critic in SAC to achieve another general-purpose MARL algorithm , MASAC . QMix : QMix ( Rashid et al. , 2018 ) is a Q-learning algorithm designed for multi-agent cooperative tasks with a global reward . The core idea of QMix is value decomposition , which formulates the global Q function , Qtot as the output of a ” mixer ” neural network whose inputs are the individual agent Q functions , Qa ; The weights of this ” mixer ” network are constrained to be positive in order to insure that ∂Qtot∂Qa ≥ 0 , ∀ agents a . This ensures that by acting greedily to maximize their local Q functions , agents will also be maximizing the global Q function . QMix was first introduced in the StarCraftII micromanagement and has been a popular benchmark algorithm for this challenge . However , it is rarely tested in other domains . MAPPO : In addition to the off-policy algorithms above , we also consider an on-policy MARL algorithm , i.e. , a multi-agent variant of PPO ( MAPPO ) . We enhance the standard decentralized PPO algorithm by learning a centralized critic that takes in the global state or the concatenation of each agent ’ s local observation ( when global state is not available ) . This idea of centralized value functions was originally introduced in the COMA algorithm ( Foerster et al. , 2018 ) . Our implementation follows the details in Baker et al . ( 2019 ) , including using two separate networks for policy and value function , GAE , advantage normalization and a Pop-Art value normalizer ( Hessel et al. , 2019 ) , which uses running statistics of the values to normalizes the regression target of value network to zero mean and a standard deviation of one .
The major contribution of this paper is benchmarking 5 MARL algorithms on 4 cooperative multi-agent environments. Also, this paper found that under constrained hyperparameter search budgets, the multi-agent PPO algorithm has more consistent performance over the other algorithms across different tested multi-agent environments. The code base is open-sourced for public use, which benefits the MARL community.
SP:2e305b4762d57663e3c96ae164a9cd385dfe9549